Commit graph

41120 commits

Author SHA1 Message Date
Ricardo Salveti
00009d5b96 board: nrf52_nitrogen: Include BLE controller by default
Enable the new BLE controller by default in nRF52's Nitrogen board.

Change-Id: I1692fc8853c1971c22a6a62e052d6f04b881ffca
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-09-07 08:17:26 +03:00
Johan Hedberg
3931b402e8 Bluetooth: Kconfig: Remove unnecessary default conditionals
There should always be one unconditional default and then a
conditional for each exception.

Change-Id: If1043c70eaae631c0a46c0af065a77199eb8e91b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery
cb3120d440 Bluetooth: L2CAP: Disable fragmentation of rx pdu
Currently if rx mtu is more than ACL in buffer size, then controller
fragments the data (if its more than buffer size) but recombination
in host is failing because of buf limiation (and seeing below error)
"Not enough buffer space for L2CAP data" in bt_conn_recv()

Change-Id: Iac0455eb1848fa228fce88fec9810d20542b0759
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Johan Hedberg
2599974189 Bluetooth: Controller: Fix coding style in ctrl.c, util/ and main.c
Initial sweep of controller code to fix the coding style.

Change-Id: Ib71c5a4657a1f162273f2dcd485fe70fff934928
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-07 08:17:26 +03:00
Luiz Augusto von Dentz
50997f2ccd Bluetooth: GATT: Add queuing support
This adds queueing support for requests that requires a response making
it simpler to use the API. The storage is keep in the parameters of the
request so it is up to the application to define how many can be queued
but in case the application don't want a request to block waiting for
a buffer it can use BLUETOOTH_ATT_REQ_COUNT to control the available
buffers which is recommended in case the requests will be sent from the
RX fiber.

Change-Id: I407c3982a7ecdc4a9eff7172d9d0addd46949783
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada
8e722ef545 Bluetooth: tests: Add BLE controller init tests
Jira: ZEP-702

Origin: Original
Change-Id: I55fa102069db155e8fd461513abbe898f64d8977
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada
b434ef8212 board: nrf52_pca10040: Include BLE controller by default
Enable the new BLE controller by default in Nordic's nRF52 DK
(Development Kit) board.

Jira: ZEP-702

Origin: Original
Change-Id: I578d582536186e326c81f9274faa2c0f1ae851ff
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada
5c01a7e3b3 Bluetooth: Controller: Add BLE controller driver
The main.c source file in drivers/bluetooth/controller acts as
the necessary glue between the Link Layer and Zephyr's
Bluetooth subsystem.  It instantiates the required RX fiber and
marshalls the control and data traffic between the BLE radio
and the BLE stack.

Jira: ZEP-702

Origin: Original
Change-Id: Ia62baedcd6e3ea83bd16306779357930f9a6c5f7
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada
48c48711e6 Bluetooth: Controller: A full, hardware-agnostic BLE Link Layer
The ll/ folder contains a full implementation of a BLE Link Layer
interfacing with a baseband and a radio through radio.h. The
current code implements most Bluetooth 4.2 features and is
currently functional and tested with nRF5x ICs from Nordic
Semiconductor.

Jira: ZEP-702

Origin: Original
Change-Id: Ib79cd97142d1a72c99dcf2a88116ac97ddd90a2b
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada
c160a0548d Bluetooth: Controller: Add initial HCI implementation
For the Link Layer to be able to communicate with the rest of
the BLE stack in Zephyr, this barebones HCI controller
implementation includes an initial version of the fundamental
commands and events required.

Jira: ZEP-702

Origin: Original
Change-Id: I38bc9dae34e7075ab8b8178fd6b6659e2dec53b0
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada
0d3d1d5c83 Bluetooth: Controller: Add a util folder with basic primitives
The util folder contains memory management, queue management
and misc utilities used by the Link Layer implementation.
This will be in time replaced by Zephyr's native functionality.

Jira: ZEP-702

Origin: Original
Change-Id: Id8602ea41ec44811801dfc582bab244c339eabe3
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada
87d4d27731 Bluetooth: Controller: Hardware abstraction layer for nRF5x radio
The drivers/bluetooth/controller path adds a native BLE Link
Layer (controller and HCI) to the Bluetooth subsystem. This first
implementation adds support for the nRF5x series of devices
from Nordic Semiconductor. The hal/ folder inside the controller
contains all IC-specific code to interface with the radio and
baseband.

Jira: ZEP-702

Origin: Original
Change-Id: I4ed61d5f67af6b4735d746a38a5b55f054521075
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada
02c11b501f MAINTAINERS: Add BLUETOOTH CONTROLLER section
The drivers/bluetooth/controller path adds a native BLE
controller (Link Layer and HCI) to the Bluetooth subsystem.

Jira: ZEP-702

Change-Id: If7049d76dd3cb2152a705bde7d4a7e9e725cf343
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Szymon Janc
5ff76656b0 Bluetooth: Fix typo in code comment
Change-Id: Ic1901fd6b8ab6c2e8f4dc20a60d29e6f19671fef
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery
febdf2dc0b Bluetooth: RFCOMM: Fix cr bit of address in MSC response
cr bit of address in MSC should be always 1 irrespective of whether it
is command or response. Command/Response would be identified by cr bit
of msg type in UIH

Change-Id: I8e8b8446fa98aa07269953cfb6e54be915d4aba7
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Szymon Janc
1c81bdffc4 Bluetooth: tests/shell: Remove not needed RFCOMM option from config
prj.conf is for single mode LE controllers.

Change-Id: I138a560f4e33f6663135bbcbb4d8aeb5955342a1
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Arkadiusz Lichwa
1c34f1e322 Bluetooth: L2CAP: Fix reset channel state context
Since now CoC on each transport has registered own 'destroy' handler
it can be used to reset per transport L2CAP channel context. Then when
bt_l2cap_chan_del() API is called there's no more need to use
preprocessor to handle reset channel's state.

Change-Id: I1abb5d380a31ec54e2b6613d994ffdb0f94b93a5
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-09-07 08:17:26 +03:00
Arkadiusz Lichwa
0569ef32b9 Bluetooth: L2CAP: Refactor connection security handler
Makes main security handler verifying incoming connection request on
BR/EDR transport to be more descriptive and readable. Its output
result is now more fine-grained.

Change-Id: Ifc3960bd16219e92f6e61700c61605cf05e4d6d3
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-09-07 08:17:26 +03:00
Szymon Janc
ada1b0a594 Bluetooth: tests/shell: Add dedicated BR/EDR config
BR/EDR support in chip is mandatory if BR/EDR is enabled so add
separate config for it. This is to avoid problems when using
single mode LE controller.

Change-Id: I9d9692b89883dd1980803d66818fb6e3a368afb0
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery
407013f3c7 Bluetooth: RFCOMM: Handle data and credit from peer
Data is transferred in UIH frame to a valid dlci. In this case the
meaning of PF bit is different, if PF bit is 1 then credit is there
in the frame otherwise no credit (only user data). So basically UIH
frame to a valid dlci can be "Only data, Only credit, both credit and
data"

Only credit
> ACL Data RX: Handle 256 flags 0x02 dlen 9
      Channel: 64 len 5 [PSM 3 mode 0] {chan 0}
      RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
         Address: 0x0b cr 1 dlci 0x02
         Control: 0xff poll/final 1
         Length: 0
         FCS: 0x86
         Credits: 33
        86

Only data
> ACL Data RX: Handle 256 flags 0x02 dlen 9
      Channel: 64 len 5 [PSM 3 mode 0] {chan 0}
      RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
         Address: 0x0b cr 1 dlci 0x02
         Control: 0xef poll/final 0
         Length: 1
         FCS: 0x9a
        ff 9a

Change-Id: Iaa48f9aa022f33e1a1217f19dc59ce761cfeac74
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery
d6af0ef091 Bluetooth: RFCOMM: Perform MSC transaction after dlc
MSC (Modem status command) is used to convey RS-232 control and break
signals. This shall be sent prior to any user data after dlc. Remote
also would have sent it which is handled in this patch

This has meaning only if a port emulation entity is there on top (which
is not there in zephyr right now). So currently v24 signal is hard
coded like below.
DV = 1 IC = 0 RTR = 1 RTC = 1 FC = 0 EXT = 0

< ACL Data TX: Handle 256 flags 0x00 dlen 12
      Channel: 64 len 8 [PSM 3 mode 0] {chan 0}
      RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
         Address: 0x01 cr 0 dlci 0x00
         Control: 0xef poll/final 0
         Length: 4
         FCS: 0xaa
         MCC Message type: Modem Status Command CMD (0x38)
           Length: 2
           dlci 2
           fc 0 rtc 1 rtr 1 ic 0 dv 1
> ACL Data RX: Handle 256 flags 0x02 dlen 12
      Channel: 64 len 8 [PSM 3 mode 0] {chan 0}
      RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
         Address: 0x03 cr 1 dlci 0x00
         Control: 0xef poll/final 0
         Length: 4
         FCS: 0x70
         MCC Message type: Modem Status Command CMD (0x38)
           Length: 2
           dlci 2
           fc 0 rtc 1 rtr 1 ic 0 dv 1
< ACL Data TX: Handle 256 flags 0x00 dlen 12
      Channel: 64 len 8 [PSM 3 mode 0] {chan 0}
      RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
         Address: 0x01 cr 0 dlci 0x00
         Control: 0xef poll/final 0
         Length: 4
         FCS: 0xaa
         MCC Message type: Modem Status Command RSP (0x38)
           Length: 2
           dlci 2
           fc 0 rtc 1 rtr 1 ic 0 dv 1
> ACL Data RX: Handle 256 flags 0x02 dlen 12
      Channel: 64 len 8 [PSM 3 mode 0] {chan 0}
      RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
         Address: 0x03 cr 1 dlci 0x00
         Control: 0xef poll/final 0
         Length: 4
         FCS: 0x70
         MCC Message type: Modem Status Command RSP (0x38)
           Length: 2
           dlci 2
           fc 0 rtc 1 rtr 1 ic 0 dv 1

Change-Id: Iab06f12de2f2357485309eb622c8c5e13db7011c
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery
b773edc053 Bluetooth: RFCOMM: Move rfcomm_make_uih_msg() up
It has to be used to send MSC from rfcomm_dlc_connected()

Change-Id: I96fa161359c54d31e8cccb9fa3aa749465308f61
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery
d19752b955 Bluetooth: shell: Add support for RFCOMM test
Sets new command in BT shell app to allow register one RFCOMM server.
Syntax:
>br-rfcomm-register <Channel>

It also accept the connection from remote and provides dlc object

Change-Id: I99f672ee68785338f3bf22948d4f33b3e1aecd2e
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery
d363b6896c Bluetooth: RFCOMM: Handle incoming dlc request
Handles SABM request to a valid dlci and sends UA response. If PN is
not negotiated for this dlci prior, then accept callback will be invoked
to profile. Dlc will be connected at this point and user can start
sending data over this dlc

> ACL Data RX: Handle 256 flags 0x02 dlen 8                                                                                                                                        [hci0] 210.138443
      Channel: 64 len 4 [PSM 3 mode 0] {chan 0}
      RFCOMM: Set Async Balance Mode (SABM) (0x2f)
         Address: 0x0b cr 1 dlci 0x02
         Control: 0x3f poll/final 1
         Length: 0
         FCS: 0x59
< ACL Data TX: Handle 256 flags 0x00 dlen 8                                                                                                                                        [hci0] 210.140102
      Channel: 64 len 4 [PSM 3 mode 0] {chan 0}
      RFCOMM: Unnumbered Ack (UA) (0x63)
         Address: 0x0b cr 1 dlci 0x02
         Control: 0x73 poll/final 1
         Length: 0
         FCS: 0x92

Change-Id: I6bf5efb811d3ca5b106c9dff67d3a50a74818956
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery
ab96eae52d Bluetooth: RFCOMM: Handle PN request
PN (Parameter negotiation) is used to negotiate parameters like mtu.
Initial credit for flow control is also sent in PN. If the dlci to which
PN requested is not found in the dlc list then it will be treated as
incoming dlc request and accept callback will be called to profile.
Dlc mtu has to be set by profile (before it returns dlc) which will be
negotiated with remote. But the final mtu will be min of mtu provided
by profile, mtu sent by remote, and session mtu

> ACL Data RX: Handle 256 flags 0x02 dlen 18                                                                                                                                       [hci0] 210.108444
      Channel: 64 len 14 [PSM 3 mode 0] {chan 0}
      RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
         Address: 0x03 cr 1 dlci 0x00
         Control: 0xef poll/final 0
         Length: 10
         FCS: 0x70
         MCC Message type: DLC Parameter Negotiation CMD (0x20)
           Length: 8
           dlci 2 frame_type 0 credit_flow 15 pri 7
           ack_timer 0 frame_size 122 max_retrans 0 credits 7
< ACL Data TX: Handle 256 flags 0x00 dlen 18                                                                                                                                       [hci0] 210.111452
      Channel: 64 len 14 [PSM 3 mode 0] {chan 0}
      RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
         Address: 0x01 cr 0 dlci 0x00
         Control: 0xef poll/final 0
         Length: 10
         FCS: 0xaa
         MCC Message type: DLC Parameter Negotiation RSP (0x20)
           Length: 8
           dlci 2 frame_type 0 credit_flow 14 pri 0
           ack_timer 0 frame_size 30 max_retrans 0 credits 7

Change-Id: Ifd466db6b3b868d04e38db02ebad6e47ab2da030
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery
7eec8a4442 Bluetooth: RFCOMM: Handle signalling connection request
Handles the SABM request to dlci 0 and sends UA response which makes
session state as CONNECTED. Session mtu is set as min of l2cap tx and
rx mtu since in rfcomm mtu is symmetric (unlike L2CAP). This means that
mtu of all the dlcs should be less than or equal to its session mtu so
that each rfcomm frame can be contained in single l2cap pdu.

> ACL Data RX: Handle 256 flags 0x02 dlen 8                                                                                                                                        [hci0] 210.078442
      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 TX: Handle 256 flags 0x00 dlen 8                                                                                                                                        [hci0] 210.080586
      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

This also inntroduces table and functions to calculate and
check FCS. These are taken from GSM 07.10 TS 101 369 V6.5.0

Change-Id: Ief5822b7f9350f50e700ff4f460c818a5a1068b7
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery
a816142687 Bluetooth: RFCOMM: Init buffer for outgoing signalling packets
Buffer size is currently set as rfcomm min mtu

Change-Id: Ie8fd3f1cef9d6d9b62d5aca272f0030181175460
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Johan Hedberg
d0504ffc34 Bluetooth: Add missing guards to hci_raw.h header file
Each public header file needs the #ifdef guards as well as a
declaration for C++ compatibility.

Change-Id: If270de1ee74e2e74eab02d218417d80fcbf422ac
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-07 08:17:26 +03:00
Andrei Emeltchenko
210596e246 Bluetooth: Include btusb sample to sanity check
Change-Id: I05aeb54124b7dbf36aa730e04a105683eb8c4eaa
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-09-07 08:17:26 +03:00
Andrei Emeltchenko
e8abb72a6a Bluetooth: Export USB HCI controller using RAW HCI channel
The application exports Bluetooth controller over USB as USB HCI
dongle using RAW HCI channel introduced in the previous patch.

When connected to Linux is should be handled by btusb driver.

usb-devices output:

T:  Bus=05 Lev=03 Prnt=121 Port=00 Cnt=01 Dev#= 22 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=8086 ProdID=ff02 Rev=01.00
S:  Manufacturer=Intel
S:  Product=BTUSB12
S:  SerialNumber=00.01
C:  #Ifs= 2 Cfg#= 1 Atr=c0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb

Change-Id: I8bc362876353b6c97eb7051f4cdff3d8a9f55abd
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-09-07 08:17:26 +03:00
Andrei Emeltchenko
2b12ca875f Bluetooth: Add documentation to HCI RAW interface
Describe bt_enable_raw() and bt_send() functions.

Change-Id: I0eb18dd2364eec0eb2a8c3e7b537d87e984dd90e
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-09-07 08:17:26 +03:00
Andrei Emeltchenko
6ab1b9cdc4 Bluetooth: Add RAW API interface to Bluetooth
HCI RAW channel API is intended to expose HCI interface to the remote
entity. The local Bluetooth controller gets owned by the remote entity
and host Bluetooth stack is not used. RAW API provides direct access
to packets which are sent and received by Bluetooth HCI drivers.

Change-Id: I4ba2b7ca2c2b0d6c5de6ef1f231d1c5b82125e09
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-09-07 08:17:26 +03:00
Szymon Janc
0b67e04922 Bluetooth: tests/shell: Set same name on BR/EDR and LE
This sets BR/EDR name with same value used over LE.

Change-Id: I29407b0b44907b520b0f39afe868fc612c5e47d4
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Szymon Janc
017586707e Bluetooth: Set BR/EDR device name on init
This adds support for setting default BR/EDR name on init. For now
this is just static configuration but can be extended later on
to allow runtime configuration if requested.

< HCI Command: Write Local Name (0x03|0x0013) plen 248
        Name: Zephyr
> HCI Event: Command Complete (0x0e) plen 4
      Write Local Name (0x03|0x0013) ncmd 1
        Status: Success (0x00)

Change-Id: I59ecfc2be8e55c6f90cdb0f12c6fed7f7ce976f8
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery
7859ffeab0 Bluetooth: RFCOMM: Implement Register Server channel API
Profiles can use this API to register the RFCOMM server channel.
DLC structure which represents individual connnection on a particular
server channel has to be defined in the profile and provide it in
accept callback.

Change-Id: I14e607ca65a29f29389deb2ac5d0658f5cd92883
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery
b4aa810f0c Bluetooth: RFCOMM: Initialize and register to L2CAP
Initialize RFCOMM layer and register PSM to L2CAP. RFCOMM session
which represents the signalling context is also defined. Only one
signalling context will be there per ACL connection and hence l2cap
chan object is embedded into session.

Change-Id: I9b0931b51753571f5da40c76f4b8a7d5f93546fb
Origin: Original
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Johan Hedberg
71680a6053 Bluetooth: Fix race condition when initializing ECC FIFO
First access to the ecc_queue may happen either from an application
task (calling bt_enable()) or from the internal ECC task. Since we
don't have control of this we need to do conditional initialization of
the FIFO.

Change-Id: I5c96782ec7a6f829da0fe15e13817934319381df
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery
2f13527766 Bluetooth: L2CAP: Implement bt_l2cap_br_chan_send()
Sends the packet to HCI using bt_l2cap_send()

Change-Id: Iaec86ddc53adc632b597237a248acbd2e61fe4f6
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada
8704406a84 Bluetooth: Fix race condition between ecc_send and ecc_task
Move initialization of ecc_queue from ecc_task into bt_hci_ecc_init,
so that calling ecc_send before ecc_task has no race condition and is
safe.

Change-Id: I775a1de3c5b6f56ae4ae37baa948ef19da6cee55
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Szymon Janc
3be711b17a Bluetooth: L2CAP: Make bt_l2cap_br_fixed_chan_register global
This will be used to register additional (ie SMP) BR/EDR fixed
channels and must be available for other modules.

Change-Id: Ie5d8ff5ccb6805379d6773254f4107434edaa076
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Szymon Janc
52d5966ac7 Bluetooth: L2CAP: Use BIT macro for supported BR/EDR fixed channels
There is no need for using extra mask define as BIT macro results in
better readability.

Change-Id: I95ac03f43274bfa5c571a6bfbc49a93513465bdf
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Szymon Janc
cfb396955a Bluetooth: L2CAP: Remove mask from struct bt_l2cap_fixed_chan
There is no need to keep this info per channel. Information response
use fixed value so those were not used anyway.

Change-Id: I2e5d394f25075be12062394e4d9f2db4f133a796
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Szymon Janc
c10d6156d6 Bluetooth: Fail on init if BR/EDR is enabled but not supported
For now if BR/EDR support is enabled we require chip to support it.
This is due to rest of the BR/EDR code doesn't do runtime check but
just assumes BR/EDR is there.

Change-Id: I26124a7f1a06cd65800c0b1b17842eb4a4ffb6cb
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Szymon Janc
945fbfe52b Bluetooth: SMP: Add self test for H6 function
This adds self test for H6 key derivation function based on sample data
from Core Specification Vol 3. Part H. Appendix D. D6.

Change-Id: I73eed5bfc6604bee0d1e81a23895f54ca6904807
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Szymon Janc
d3bd10dda1 Bluetooth: SMP: Add support for Link Key derivation
This allows to derive BR/EDR Link Key from LE SC LTK so no further
BR/EDR pairing is needed to encrypt BR/EDR link with key as strong
as LTK.

Change-Id: Ie28e9ec7a250189b122f1bce291fa9468a758614
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Luiz Augusto von Dentz
e2b5be9087 Bluetooth: eddystone: Add timeout to deactivate configuration mode
This adds a timeout to switch from configuration mode to beacon mode
following the recommended behavior from the spec:

  The connectable timeout should be at the very least 30 seconds to let
  enough time to user to start a configuration application.

Change-Id: I8f262c447ed1622e377fd7a05dde78c7b6b0560d
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-09-07 08:17:26 +03:00
Szymon Janc
66f523bf2e Bluetooth: SMP: Refactor keys distribution bitfields
This is in preparation for adding Link Key distirbution bit which
depends on BR/EDR support.

Change-Id: I156dcae1c3488cc7fc5cc3514a048affa89f449b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Johan Hedberg
bf098dff6d Bluetooth: monitor: Fix condition for disabling UART interrupts
If interrupt-driven UARTs are not use it makes no sense to try to
disable interrupts (in fact the build will fail).

Change-Id: Ib1e020895ced08183719a4cedd703d87e922b067
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada
ad0e041e3d soc: Use nrf.h instead of nrf52.h and nrf52_bitfields.h
Since nrf.h abstracts the differences between the nRF51 and nRF52
architectures and chooses the right headers to include, it is
safer to use that instead of directly including the soc-specific
headers.

Jira: ZEP-702

Change-Id: I0e1758ede48f3422a41d226b0eab008e4ba2c77c
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Szymon Janc
28e47f60a4 Bluetooth: SMP: Add helper for notifying pairing complete
This will allow to have a single place where actions on pairing
complete would be called.

Change-Id: I7d097111e9643e98a168b6acf8d88ebb92b484a0
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00