Commit graph

1181 commits

Author SHA1 Message Date
Marek Pieta
e2905c09cb Bluetooth: controller: Fix Kconfig dependency
Change adds missing Kconfig dependency.
The CONFIG_BT_CTLR_FILTER is used only for SW Link Layers.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2020-01-23 11:00:17 +01:00
Ulf Magnusson
4e85006ba4 dts: Rename generated_dts_board*.{h,conf} to devicetree*.{h,conf}
generated_dts_board.h is pretty redundant and confusing as a name. Call
it devicetree.h instead.

dts.h would be another option, but DTS stands for "devicetree source"
and is the source code format, so it's a bit confusing too.

The replacement was done by grepping for 'generated_dts_board' and
'GENERATED_DTS_BOARD'.

Two build diagram and input-output SVG files were updated as well, along
with misc. documentation.

hal_ti, mcuboot, and ci-tools updates are included too, in the west.yml
update.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-01-17 17:57:59 +01:00
Erik Brockhoff
48b6dae329 Bluetooth: controller: split: ULL filter API modifications
Moving struct definitions into header file and adding API to
allow accessing data-structures from lll context

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2020-01-17 17:11:54 +01:00
Dominik Ermel
50f7555789 Bluetooth: Selecting ENTROPY_GENERATOR for crypto
Bluetooth sample with controller crypto, requires sys_rand32_get that
used to be linked with Tinycrypt. The selection, within Kconfig of
Tinycrypt, that has been enabling compilation of the symbol has
been removed and thus preventing controller crypto to link.

This commit moves the selection to BT_CTLR_CRYPTO.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-01-16 13:25:31 +01:00
Vinayak Kariappa Chettimada
b5c63c69ca Bluetooth: controller: split: Fix ull_disable hang
Under race conditions it is possible that there is no call
to k_sem_give to the waiting k_sem_take in the ull_disable
function.

ull_disable function checks for reference count before
using a mayfly to schedule lll_disable, which in turn
would close requested currently active role event leading
to done event being propogated to ULL. Done event would
then call the set disabled_cb callback when the reference
count is zero, giving the semaphore to the waiting
k_sem_give in the ull_disable.

Under race conditions if the reference count reached zero
after the reference count check and before the disabled_cb
was assigned in the ull_disable function, then there are
chances that a k_sem_give is not called while ull_disable
proceeds to waiting using k_sem_take.

Fixes #21586.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-16 10:54:40 +01:00
Vinayak Kariappa Chettimada
9a6d200cb9 Bluetooth: controller: legacy: Fix redundant priv variable check
Fix the redundant check of priv flag variable introduced as
regression in commit f8877e39ce ("Bluetooth: controller:
legacy: Fix controller address check").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-16 08:49:35 +01:00
Vinayak Kariappa Chettimada
51c46d94ed Bluetooth: controller: Fix CONFIG_BT_CTLR_TX_BUFFER_SIZE range
Fix CONFIG_BT_CTLR_TX_BUFFER_SIZE value range to 251 Bytes
due to implementation limitation in use of u8_t for PDU
length fields in controller Tx buffers.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-15 15:26:19 +01:00
Vinayak Kariappa Chettimada
8cd9a94b2f Bluetooth: controller: split: Fix controller privacy address check
Fix controllers address check in cases of controller-based
privacy is supported but not used to start advertising.

This fixes regression introduced in
commit 896619ad40 ("Bluetooth: controller: Fix
controller address check").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-15 15:24:55 +01:00
Andries Kruithof
98430a61cf Bluetooth: controller: split: Refactor DLE prepare
Refactor the event_len_prep routine to increase readability without
affecting code size

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2020-01-15 14:01:23 +01:00
Andries Kruithof
26a97aed4f Bluetooth: controller: split: Fix LENGTH_REQ PDU prepare
There is an obscure bug in the case that CFG_BT_CTLR_PHY is not defined;
when a feature-exchange already has happened the lr->max_tx_time and
lr->max_rx_time are not calculated.
This bug is fixed by this commit.

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2020-01-15 14:01:23 +01:00
Rubin Gerritsen
4ce9c9d59c bluetooth: controller: Guard zephyr LL specific configurations
This change prevents zephyr LL specific configurations to show up when
using an out of tree BLE controller.

BT_CTLR_ASSERT_HANDLER is used outside the controller as well,
so this is kept as is.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-01-14 11:07:40 -05:00
Andries Kruithof
44daa9f15c Bluetooth: controller: Refactor time calculation for LL DLE procedure
Refactor the PKT_US macro to show more clearly where the different
fields come from

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2020-01-10 14:10:23 +01:00
Vinayak Kariappa Chettimada
f8877e39ce Bluetooth: controller: legacy: Fix controller address check
Fix controllers address check in cases of controller-based privacy.
When controller has been instructed by the host to use privacy
the controller should look up the peer identity address and generate
an address based on the local IRK. In the case where no match
is found or the local IRK is all zeroes the controller shall use
the fallback address. If the fallback address is not valid the
controller shall return invalid params.

This commit fixes these issues:
 - Starting a private advertiser without valid random address set
   but a valid local IRK exists. In this case the advertiser should
   be able to advertise using the RPA regardless of a valid random
   or public address.
 - Starting a private advertiser with a fallback to the public
   address type or an adveriser using public address  does not
   check if a valid public address exists. The host cannot
   advertise with an all-zero public address.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-09 15:34:23 +01:00
Joakim Andersson
f5d2b3271a Bluetooth: controller: Fix bug in LE create conn with filter policy
Fix bug when connecting using whitelist and split controller.
The peer address was set to an all zeroes address.

Bug using shell:
bt init
bt wl-add <addr>
bt wl-connect on
Connected: 00:00:00:00:00:00 (public)

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-01-08 10:48:47 +01:00
Vinayak Kariappa Chettimada
19ac87c4f0 Bluetooth: controller: Add set adv param cmd param validation
Added implementation to validate HCI LE Set Advertising
Parameters Command parameters.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-06 17:42:34 +01:00
Vinayak Kariappa Chettimada
ec1e66ebd8 Bluetooth: controller: Add Kconfig option for parameter checking
Added Kconfig option to conditionally compile in HCI command
parameter validation code.

When building a combined host plus controller application,
only validations in the host at the top level close to the
API caller is sufficient.

The controller validations are included in controller only
builds.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-06 17:42:34 +01:00
Christopher Friedt
5308a941a9 Bluetooth: controller: define adv channel access address as macro in pdu.h
The new macro is PDU_AC_ACCESS_ADDR

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-01-06 09:58:18 +01:00
Vinayak Kariappa Chettimada
c9c65a9b9b Bluetooth: controller: split: Pass scanner LLL context in event
Pass the scanner LLL context in the generated connection
complete event with unknown connecion id for HCI Create
Connection Cancel Command Response.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-03 14:16:16 +01:00
Vinayak Kariappa Chettimada
13a3270096 Bluetooth: controller: split: Fix assert in PDU Rx quota increment
Directed advertising timeout released PDU Rx quota which it
should not be.

Relates to assert in #21006.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-03 14:16:16 +01:00
Vinayak Kariappa Chettimada
ca8b6028c6 Bluetooth: controller: split: Move statements close to related context
Minor refactor, move statements close to related context.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-03 14:16:16 +01:00
Vinayak Kariappa Chettimada
4f42baa43d Bluetooth: controller: split: Use define instead of magic number
Use HCI Error Code define instead of magic number.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-03 14:16:16 +01:00
Joakim Andersson
f675e14718 Bluetooth: controller: Use 24-bit functions for LL Features
Use 24-bit functions for LL Features copying to make byteorder more
readable.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-01-02 19:05:27 +01:00
Vinayak Kariappa Chettimada
f5bbb4d3fd Bluetooth: controller: legacy: Fix tx_time calculation for length update
Fix tx_time calculation for the case that BT_CTRL_PHY is defined and
there has not been a feature exchange.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-02 16:53:54 +01:00
Wolfgang Puffitsch
41e6016885 Bluetooth: controller: split: Fix tx_time calculation for length update
Fix tx_time calculation for the case that BT_CTRL_PHY is defined and
there has not been a feature exchange.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-02 16:53:45 +01:00
Joakim Andersson
40c20b1f18 Bluetooth: Change remote version event from prio to normal event type
This commit reverts the change that moved the remote version event from
a priority event to a normal event. This is done because the strategy
for using this event has been changed and will be used with a callback
instead of a semaphore that could be locked from the RX thread.

This commit retains the infrastructure that was added in the controller
so that moving events to priority processing is still possible.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-12-23 14:47:31 +02:00
Joakim Andersson
a34d4afe7d Bluetooth: Host: Fix issues with host IRK handling
Fix multiple issues related to the way the host handles
Identity Information related to privacy

1. If the controller provided a public address the IRK
   for this identity would be randomly generated but not
   stored persistenly.

2. Fix the handling of the above issue which was fixed
   for the random address but would initiate settings save
   ID on every boot.

3. Fix the host not using the Vendor Specific HCI commands
   related to retrieving the Identity Root (IR) from the
   controller and using the key diversified function d1
   to generate an IRK as specified in the BT Core spec.

Make sure that a Host generated ID is only saved when it is first
generated.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-12-20 15:45:34 +01:00
Joakim Andersson
091ebf905d Bluetooth: controller: Return FICR as a static address IR
Return the IR defined in FICR as the Identity Root for the static
address through the read static addresses command instead of providing
it through the Read Key Hierarchy Root command.
This is following the recommendations in the Zephyr HCI extension
document in doc/reference/bluetooth/hci.txt

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-12-20 15:45:34 +01:00
Joakim Andersson
896619ad40 Bluetooth: controller: Fix controller address check
Fix controllers address check in cases of controller-based privacy.
When controller has been instructed by the host to use privacy
the controller should look up the peer identity address and generate
an address based on the local IRK. In the case where no match
is found or the local IRK is all zeroes the controller shall use
the fallback address. If the fallback address is not valid the
controller shall return invalid params.

This commit fixes these issues:
 - Starting a private advertiser without valid random address set
   but a valid local IRK exists. In this case the advertiser should
   be able to advertise using the RPA regardless of a valid random
   or public address.
 - Starting a private advertiser with a fallback to the public
   address type or an adveriser using public address  does not
   check if a valid public address exists. The host cannot
   advertise with an all-zero public address.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
2019-12-20 15:26:41 +01:00
Vinayak Kariappa Chettimada
b0826a7f65 Bluetooth: controller: split: Reduce time to setup tIFS switch
Refactor to reduce the setup next tIFS switch within tIFS
period of the Radio ISR.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-18 22:02:02 +01:00
Vinayak Kariappa Chettimada
7ba5e012f7 Bluetooth: controller: nordic: Tune tIFS switching
Remove the 4us advanced radio reception, the implementation
passes all timing conformance tests without this.
This change should reduce some radio power consumption by
avoiding redundant reception duration.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-18 22:02:02 +01:00
Krzysztof Chruscinski
00156ad80a drivers: clock_control: nrf: Switch to single clock device
Low frequency and high frequency clocks had separate devices
while they are actually handled by single peripheral with single
interrupt. The split was done probably because opaque subsys
argument in the API was used for other purposes and there was
no way to pass the information which clock should be controlled.
Implementation changes some time ago and subsys parameter was
no longer used. It now can be used to indicate which clock should
be controlled.

Change become necessary when nrf5340 is taken into account where
there are more clocks and current approach would lead to create
multiple devices - mess.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-12-17 14:38:19 +01:00
Vinayak Kariappa Chettimada
9128200e6c Bluetooth: controller: legacy: Fix compiler warnings
Fix compiler warnings when central only support is used.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-17 13:14:37 +01:00
Vinayak Kariappa Chettimada
e23c7fbba6 Bluetooth: controller: legacy: Fix length and ping rsp
Fix LENGTH_RSP and PING_RSP to be send after Encryption
Setup under the cases where LENGTH_REQ or PING_REQ cross-
over with ENC_REQ in the same connection event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-17 13:14:37 +01:00
Vinayak Kariappa Chettimada
1ede7db159 Bluetooth: controller: legacy: Fix Tx Ctrl PDU leak
Overlapping Feature Exchange requested by host with
Encryption Setup requested by the application caused the
controller to corrupt its Tx queue leading to Tx Ctrl PDU
buffers from leaking from the system.

Relates to #21299.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-17 13:14:37 +01:00
Andrei Stoica
930d178c69 Bluetooth: controller: enable dynamic TXP over LEGACY arch (#17731)
This commit targets solving issue #17731 over the Nordic LL LEGACY
arch of the BLE stack in Zephyr. This functionality is exposed
to the user as HCI Zephyr Command extensions

- BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL
- BT_HCI_OP_VS_READ_TX_POWER_LEVEL

which enable Tx power read/write operations within BLE radio events
on a per role/connection basis.

The functionality is enabled upon the Kconfig advanced configuration
triggered by

- BT_CTLR_TX_PWR_DYNAMIC_CONTROL

depending on the enablement of Zephyr HCI vendor-specific command
extensions.

Signed-off-by: Andrei Stoica <stoica.razvan.andrei@gmail.com>
2019-12-17 12:29:57 +01:00
Andrei Stoica
abd1d047dd Bluetooth: controller: enable dynamic TXP over LL_SPLIT arch (#17731)
This commit targets solving issue #17731 over the LL_SW_SPLIT
arch of the BLE stack in Zephyr. This functionality is exposed
to the user as HCI Zephyr Command extensions

- BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL
- BT_HCI_OP_VS_READ_TX_POWER_LEVEL

which enable Tx power read/write operations within BLE radio events
on a per role/connection basis.

The functionality is enabled upon the Kconfig advanced configuration
triggered by

- BT_CTLR_TX_PWR_DYNAMIC_CONTROL

depending on the enablement of Zephyr HCI vendor-specific command
extensions.

Necessary low-level radio HAL functionality and power definitions
are also supplied to address the high-level functionality of
controlling the Tx power.

Signed-off-by: Andrei Stoica <stoica.razvan.andrei@gmail.com>
2019-12-17 12:29:57 +01:00
Vinayak Kariappa Chettimada
f95a7faa58 Bluetooth: controller: split: Fix compiler warnings
Fix compiler warnings when PHY update feature is not selected.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-16 16:16:08 +01:00
Vinayak Kariappa Chettimada
9bd8518baf Bluetooth: controller: split: Fix length and ping rsp
Fix LENGTH_RSP and PING_RSP to be send after Encryption
Setup under the cases where LENGTH_REQ or PING_REQ cross-
over with ENC_REQ in the same connection event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-16 16:16:08 +01:00
Vinayak Kariappa Chettimada
f7c890e08c Bluetooth: controller: split: Fix Tx Ctrl PDU leak
Overlapping Feature Exchange requested by host with
Encryption Setup requested by the application caused the
controller to corrupt its Tx queue leading to Tx Ctrl PDU
buffers from leaking from the system.

Fixes #21299.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-16 16:16:08 +01:00
Asger Munk Nielsen
612984e09c Bluetooth: controller: SW deferred privacy IRK size define
Replaced symbolic constants with a define for the size of IRKs.

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
2019-12-13 15:35:25 +01:00
Asger Munk Nielsen
1d412c4acd Bluetooth: controller: SW deferred privacy
Enable deferred resolve of RPA

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
2019-12-13 15:35:25 +01:00
Joakim Andersson
e978d8620f Bluetooth: controller: Fix rx buffer leak for LL Version priority event
Fix leak of the node_rx buffer when processing the LL version ind as a
priority event. This leak meant being able to establish new connections
was no longer possible, because there weren't enough events to process
the all the events during connection establishment. And instead the LL
ignored the connection request sent by the peer.

Removed the inline extern declaration of a function which had a proper
header included.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-12-13 15:15:53 +01:00
Vinayak Kariappa Chettimada
bf623906f3 Bluetooth: controller: split: Fix missing version ind state reset
Fix implementation for the missing reset of version
information procedure request state value.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-13 13:21:27 +01:00
Vinayak Kariappa Chettimada
7417e6e09e Bluetooth: controller: split: conn handle invalidation on release
Move invalidation of connection handle to connection context
release done on release of terminate rx node.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-12 08:48:24 +01:00
Wolfgang Puffitsch
d3e3f8d2b4 Bluetooth: controller: split: Move invalidation of connection handle
Move invalidation of connection handle when flushing TX buffers into
LLL context. Otherwise, LLL may or may not see invalidated handle
depending on mayfly scheduling.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-12-12 08:48:24 +01:00
Ulf Magnusson
984bfae831 global: Remove leading/trailing blank lines in files
Remove leading/trailing blank lines in .c, .h, .py, .rst, .yml, and
.yaml files.

Will avoid failures with the new CI test in
https://github.com/zephyrproject-rtos/ci-tools/pull/112, though it only
checks changed files.

Move the 'target-notes' target in boards/xtensa/odroid_go/doc/index.rst
to get rid of the trailing blank line there. It was probably misplaced.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-11 19:17:27 +01:00
Joakim Andersson
a1d73acfcd Bluetooth: HCI: Handle invalid ACL flags.
Handle invalid ACL flags in HCI transport.
Only Point to Point is supported over HCI in both directions.
Fix flushable start HCI ACL packets not allowed on LE-U connections
from Host to controller.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-12-11 12:34:34 +02:00
Vinayak Kariappa Chettimada
5f10154724 Bluetooth: controller: split: Fix HCI LE Add Device to Whitelist
According to BT Spec v5.1 Vol 2 Part E Section 7.8.16, if the
device is already in the White List, the controller should not
add the device to the White List and should return success.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-10 22:29:15 +02:00
Vinayak Kariappa Chettimada
09f7364cf8 Bluetooth: controller: legacy: Fix HCI LE Add Device to Whitelist
According to BT Spec v5.1 Vol 2 Part E Section 7.8.16, if the
device is already in the White List, the controller should not
add the device to the White List and should return success.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-10 22:29:15 +02:00
Kumar Gala
24ae1b1aa7 include: Fix use of <misc/FOO.h> -> <sys/FOO.h>
Fix #include <misc/FOO.h> as misc/FOO.h has been deprecated and
should be #include <sys/FOO.h>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-12-10 08:39:37 -05:00
Vinayak Kariappa Chettimada
92e017fd70 Bluetooth: controller: split: Support Zero Latency IRQs
Add support for Zero Latency IRQs, which avoids any Zephyr
OS or application influenced ISR latencies on the
controller's ISRs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-03 10:43:09 +01:00
Vinayak Kariappa Chettimada
dab182896e Bluetooth: controller: split: Revert broken ZLI support
This reverts commit 3096c0e741.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-03 10:43:09 +01:00
Vinayak Kariappa Chettimada
c53ca07246 Bluetooth: controller: legacy: Revert broken ZLI support
This reverts commit a1945db08a.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-03 10:43:09 +01:00
Vinayak Kariappa Chettimada
44bbdd0a94 Bluetooth: controller: Fix llcp_rx check assert
If LL Connection Parameter Request or LL Connection Update
or LL PHY Update procedure is started by the local device
while a LL Length Update Request PDU has been sent by peer
then a Rx node has been stored in the llcp_rx place holder
for generation of Length Update procedure complete.

The failing assert check is incorrect in the above scenario
hence remove. Instead a missing append of the allocated Rx
node to the llcp_rx list has been added to the controller
implementation.

This issue relates to commit d12c53f89f ("Bluetooth:
controller: split: Fix missing data len update event").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-27 18:43:02 +01:00
Vinayak Kariappa Chettimada
430df927b0 Bluetooth: controller: split: Fix aborting of connection req PDU
Fix the initiator so that connection request PDU is not abort
mid-air by preemption by the overalapping first connection
event.

If the connection establishment is in progress, then the
first connection event trying to abort the initiator will
wait the connection request to be transmited completely.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-22 08:40:41 +01:00
Vinayak Kariappa Chettimada
d5314b8387 Bluetooth: controller: split: Add missing BT_DEBUG_ENABLED define
Add missing BT_DEBUG_ENABLED definitions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-21 17:08:37 +01:00
Vinayak Kariappa Chettimada
2993b1ec0a Bluetooth: controller: legacy: Add missing BT_DEBUG_ENABLED define
Add missing BT_DEBUG_ENABLED definitions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-21 17:08:37 +01:00
Vinayak Kariappa Chettimada
83d6e5d3d4 Bluetooth: controller: Add missing BT_DEBUG_ENABLED define
Add missing BT_DEBUG_ENABLED definitions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-21 17:08:37 +01:00
Vinayak Kariappa Chettimada
e27abee331 Bluetooth: controller: split: Schedule first conn event ASAP
Enable ticker job mayfly as soon as possible when
establishing connection. This is required so as to not miss
the first connection event in slow CPU like in nRF51 series.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-21 17:08:03 +01:00
Alex Porosanu
fec5bbb1c1 Bluetooth: controller: openisa: sync with Nordic SW LL
There are some changes that were introduced to the Nordic SW LL,
and as such, in order to maintain compatibility, propragate them
to the OpenISA SW LL as well.

Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
2019-11-21 10:35:16 +01:00
Vinayak Kariappa Chettimada
91fe1d9aa1 Bluetooth: controller: split: Dont use continuous directed adv in nRF51
In nRF51 which uses CONFIG_BT_CTLR_LOW_LAT, the advertising
PDU tend to get aborted in directed advertising at event slot
durations.

Dont not use continuous directed advertising event in nRF51
where CONFIG_BT_CTLR_LOW_LAT scheduling design alternative
is used. Instead close the event after each triplet of PDU
has been tx-ed.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-21 08:43:41 +01:00
Vinayak Kariappa Chettimada
528944708c Bluetooth: controller: split: Fix non-connectable event slot time
Fix the calculation of non connectable advertising event
slot reservation duration.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-21 08:43:05 +01:00
Vinayak Kariappa Chettimada
b33ccbf275 Bluetooth: controller: split: Fix directed adv event interval
Fix the directed advertising event interval calculation.
When CONFIG_BT_CTLR_LOW_LAT is used then prepare duration
has to be included in the event slot reservation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-21 08:42:27 +01:00
George Stefan
d2212581be Bluetooth: controller: split: Fix check for control procedures request
Remove wrong #ifdef that guarded the control procedures request check

Signed-off-by: George Stefan <george.stefan@nxp.com>
2019-11-20 19:37:42 +01:00
Vinayak Kariappa Chettimada
3805290055 Bluetooth: controller: legacy: Fix the slow Enc Setup alternative
Fix the implementation of slow encryption setup design
alternative to send ENC_RSP PDU before sending REJECT_IND
or REJECT_EXT_IND PDU.

Fixes #19917.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-19 13:53:50 -05:00
Vinayak Kariappa Chettimada
62f939adb8 Bluetooth: controller: split: Fix typo EVENT_RX_TX_TURNARROUND
Fix typo in EVENT_RX_TX_TURNARROUND.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-19 15:37:56 +01:00
Vinayak Kariappa Chettimada
4a42e636e8 Bluetooth: controller: Fix Code PHY update support dependency
Fix the regression introduced as part of
commit 57d9411837 ("bluetooth: kconfig: disable some
options for openisa/RV32M1").

Also, prior to PR that introduced this regression, the Coded
PHY support selection was incorrectly depending on PHY update
support Kconfig BT_PHY_UPDATE. This was already fixed as part
the previous PR.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-15 16:01:31 +01:00
Emil Obalski
446d98b09e bluetooth: Add bluetooth support for nRF52833
This commit adds support for bluetooth in nRF52833 SoC.
Bluetooth radio related files created and added to Zephyr.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2019-11-13 10:33:38 -06:00
Morten Priess
087706498e bluetooth: controller: Perform synchronized LLL reset via mayfly
Use semaphore to synchronize lll_reset completion with HCI thread for
returning (command complete) only when all is done.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-11-12 11:34:28 +01:00
Erik Brockhoff
ed61065f2c Bluetooth: controller: ull_filter: RPA ADV refresh fix
local variable (idx) was used in conflicting contexts

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2019-11-12 11:30:05 +01:00
Vinayak Kariappa Chettimada
d1d603afc3 Bluetooth: controller: split: Fix conn update to be cacheable
Fix connection update procedure to be cacheable if any other
local or remote control procedure is in progress.

Relates to commit 9c14567ce2 ("Bluetooth: controller: Fix
conn update to be cacheable").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-11 14:17:35 +01:00
Carles Cufi
4657d8515a Bluetooth: controller: openisa: Fix radio ISR signature
Non-direct ISRs are supposed to take a void pointer as an argument,
unliike direct ones, which take no arguments. Since the radio ISR is not
declared as direct, the void pointer argument was missing, likely due to
a copy-paste mistake from the nordic LLL, which indeed uses a direct ISR
for the radio ISR.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-11-11 13:53:03 +01:00
Anas Nashif
53f30bc3ac Bluetooth: controller: openisa: do not use instances for openisa IRQs
An issue with DT generation where instance defines are not determinstic
generating values that collide with existing IRQs.

Fixes #20558

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-11-10 11:17:35 -05:00
Ioannis Glaropoulos
9d52f798c5 bluetooth: controller: define SW IRQ structure for nRF53 SoCs
Extend the nRF5-specific SW IRQ framework to support nRF53.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-08 19:26:35 +01:00
Ioannis Glaropoulos
fb56d56dc9 bluetooth: controller: setup nRF53 DDPI configuration for Coded PHY
This commit provides the DPPI configuration for the Radio
driver for nRF5340 SoC, supporting LE Coded PHY.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-08 19:26:35 +01:00
Ioannis Glaropoulos
17859e1eee bluetooth: controller: setup DDPI configuration for nRF5340
This commit provides the DPPI configuration for the Radio
driver for nRF5340 SoC.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-08 19:26:35 +01:00
Ioannis Glaropoulos
0186c66ac3 bluetooth: controller: enable support for nRF53 when building radio.c
Add the require #ifdef blocks in radio.c, in order to support
building for nRF53 SoC series (and, in particular, for nRF5340
CPU1 SoC).

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-08 19:26:35 +01:00
Ioannis Glaropoulos
1b3039ef1a bluetooth: controller: include nRF5340-specific radio header
Conditionally include nrf5340_radio.h when building the
BLE controller for nRF5340 SoC. Introduce the header for
nrf5340.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-08 19:26:35 +01:00
Ioannis Glaropoulos
613e716e11 bluetooth: controller: enable support for nRF53 in Kconfig
This commit enables support in bluetooth/controller/Kconfig
for nRF53 series of SoCs.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-08 19:26:35 +01:00
Ioannis Glaropoulos
a7a4c89579 bluetooth: controller: conditionally define NRF_RADIO_TXPOWER_POS4DBM
nRF5340 does not support a Radio TX power of 4dBm, so we
introduce a dependency for the respective Kconfig option
for TX power, so the option is never defined for nRF5340.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-08 19:26:35 +01:00
Ioannis Glaropoulos
53e4c215ee include: bluetooth: define hci macro for nRF53
Define the nRF53 HW variant in include/bluetooth/hci_vs.h
and pass the define in hci_vendor.h

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-08 19:26:35 +01:00
Trond Einar Snekvik
c704495807 Bluetooth: Move Company ID config out of ctlr
The Company ID concept is not restricted to the controller, and should
be part of the wider Bluetooth scope, so it can be used on a
controller-less device. It's used in multiple host level modules, most
notably the Bluetooth Mesh and Device Information Service.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2019-11-08 16:16:37 +01:00
Alex Porosanu
57d9411837 bluetooth: kconfig: disable some options for openisa/RV32M1
Some Bluetooth options are currently not supported by the experimental
BLE SW LL implementation done on VEGABoard. As such, hide them from
the user altogether.

The full list of disabled config options is as follows:

- CONFIG_BT_PHY_UPDATE
- CONFIG_BT_DATA_LEN_UPDATE
- CONFIG_BT_HCI_VS
- CONFIG_BT_CTLR_LE_ENC
- CONFIG_BT_CTLR_CONN_PARAM_REQ
- CONFIG_BT_CTLR_EXT_REJ_IND
- CONFIG_BT_CTLR_SLAVE_FEAT_REQ
- CONFIG_BT_CTLR_LE_PING
- CONFIG_BT_CTLR_PRIVACY
- CONFIG_BT_CTLR_EXT_SCAN_FP
- CONFIG_BT_CTLR_CHAN_SEL_2
- CONFIG_BT_CTLR_ADV_EXT
- CONFIG_BT_CTLR_XTAL_ADVANCED
- CONFIG_BT_CTLR_SCHED_ADVANCED
- CONFIG_BT_CTLR_TIFS_HW

Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
2019-11-08 15:38:57 +01:00
David Leach
5edcb7dc2a bluetooth: controller: openisa/RV32M1: add debug pins support
Add SW defined BLE LL debug support on Vega platform by using
the debug GPIO pins infrastructure.

Signed-off-by: David Leach <david.leach@nxp.com>
2019-11-08 15:38:57 +01:00
George Stefan
d87aaa6107 bluetooth: controller: openisa/RV32M1: enable the BLE SW controller
This patch updates the config files required to enable the
BLE SW defined controller to be built on RV32M1 SoCs. Only the split
version is supported.

Signed-off-by: George Stefan <george.stefan@nxp.com>
Signed-off-by: Radu Alexe <radu.alexe@nxp.com>
Signed-off-by: Ionut Ursescu <ionut.ursescu@nxp.com>
2019-11-08 15:38:57 +01:00
George Stefan
b063456015 bluetooth: controller: openisa/RV32M1: BLE Link Layer ULL/LLL split
This commit takes the Nordic LLL and adapts it for RV32M1 SoCs, using
the blocks that are specific to this SoC: the GenFSK & LPTMR IP
blocks.

Signed-off-by: George Stefan <george.stefan@nxp.com>
Signed-off-by: Radu Alexe <radu.alexe@nxp.com>
Signed-off-by: Ionut Ursescu <ionut.ursescu@nxp.com>
2019-11-08 15:38:57 +01:00
George Stefan
24d9ad2494 bluetooth: controller: openisa/RV32M1: add HAL for LPTMR & GenFSK
This commit adds the HAL layer needed for the BLE controller
LL on RV32M1 SoCs on OpenISA boards. Specifically, the controller
makes use of the the GenFSK and LPTMR IP blocks.

Signed-off-by: George Stefan <george.stefan@nxp.com>
Signed-off-by: Radu Alexe <radu.alexe@nxp.com>
Signed-off-by: Ionut Ursescu <ionut.ursescu@nxp.com>
2019-11-08 15:38:57 +01:00
David Leach
94106a8ff3 boards: riscv: rv32m1: add support for GPIO debugging
Having a pin toggle when the code reaches a certain point
is really useful for debugging; the infrastructure is already
in place for Nordic boards, so just build upon and enable the
mechanism on the Vega board as well.

Signed-off-by: David Leach <david.leach@nxp.com>
2019-11-08 15:38:57 +01:00
Andrzej Głąbek
d84447e943 bluetooth: nordic: Update nrfx HAL calls with pointers to HW instances
Update calls to nrfx HAL functions to reflect API changes introduced in
nrfx 2.0.0. All these functions are now called with the first parameter
pointing to the structure of registers of the relevant peripheral.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-11-08 14:54:12 +01:00
Vinayak Kariappa Chettimada
2f965a1fb0 Bluetooth: controller: split: Fix DLE for remote unsupported Coded PHY
Fix Data Length Procedure to use Feature Exchange values to
send correct parameters based on whether Coded PHY is
supported by remote peer.

Relates to BT TS.5.1.1 tests:
LL/CON/MAS/BV-129-C
LL/CON/MAS/BV-130-C
LL/CON/SLA/BV-132-C
LL/CON/SLA/BV-133-C

Relates to commit fca32e41e6 ("Bluetooth: controller: Fix
DLE for remote unsupported Coded PHY").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-08 14:30:25 +01:00
Vinayak Kariappa Chettimada
48e5d9482a Bluetooth: controller: split: Fix the slow Enc Setup alternative
Fix the implementation of slow encryption setup design
alternative to send ENC_RSP PDU before sending REJECT_IND
or REJECT_EXT_IND PDU.

Fixes #19917.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-08 14:29:36 +01:00
Vinayak Kariappa Chettimada
0a892310d3 Bluetooth: controller: split: Fix feature exchange state reset
Fix feature exchange event generation to be correctly
deferred to wait for Rx node availability for cases when
the procedure has already been performed on air.

Without this fix, remote feature request from host may not
get back a HCI event back.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-08 14:29:21 +01:00
Vinayak Kariappa Chettimada
ebb2c0d208 Bluetooth: controller: split: Port missing break latency
Port missing implementation of the slave latency break
when there is data to be sent to peer master. Without this
initial data send from slave is delay by upto the slave
latency number of connection events.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-08 14:29:07 +01:00
Vinayak Kariappa Chettimada
f344516a0b Bluetooth: controller: split: Fix enc procedure reject handling
This is a port of the commit 4135fb55f1 ("Bluetooth:
controller: Fix rejected enc procedure not terminated") and
commit 4d59ef306b ("Bluetooth: controller: Check if enc
procedure is in progress").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-08 14:28:10 +01:00
Wolfgang Puffitsch
e108898270 Bluetooth: controller: split: Make number of TX ctrl buffers configurable
A single connections may take up to 4 buffers at the same time. Make
number of connections that support this worst-case number
configurable.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-11-06 17:58:54 +01:00
Vinayak Kariappa Chettimada
3420f0863c Bluetooth: controller: split: Add data length procedure queueing
Added implementation to cache Data Length Procedure when
another control procedure is in progress.

Relates to commit 26317491e04b ("Bluetooth: controller: Add
data length procedure queueing").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-06 12:46:52 +01:00
Vinayak Kariappa Chettimada
b9a8682d78 Bluetooth: controller: split: Fix Re-encryption procedure
Fix MIC failure on re-encryption procedure when responding
at the same time to peer initiated feature request.

Relates to commit 560d6ddb964c ("Bluetooth: controller: Fix
Re-encryption procedure").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-06 12:46:52 +01:00
Vinayak Kariappa Chettimada
11c3d2cd4e Bluetooth: controller: split: Fix ENC_REQ PDU retransmission
Fix dropped ENC_REQ PDU when retransmitting, if slave was
not listening or nack-ed it.

Relates to commit 31256568a283 ("Bluetooth: controller: Fix
ENC_REQ PDU retransmission").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-06 12:46:52 +01:00
Vinayak Kariappa Chettimada
bff76b4cce Bluetooth: controller: split: Fix control tx queue handling
Fix control tx queue handling to correctly pause control PDU
responses during encryption setup.

Relates to commit 4b4b650174bf ("Bluetooth: controller: Fix
control tx queue handling").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-06 12:46:52 +01:00
Vinayak Kariappa Chettimada
16dbb9a4fe Bluetooth: controller: split: Fix cmd disallowed and collision disconnects
Fix implementation to correctly cache the control procedures
initiatable by local and peer. And, fix feature exchange and
version information procedures from being disallowed by
having then as cached requests to the controller.

Relates to #15256 and commit 0dcfa3853782 ("Bluetooth:
controller: Fix cmd disallowed and collision disconnects").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-06 12:46:52 +01:00
Vinayak Kariappa Chettimada
b0c495791a Bluetooth: controller: split: Fix start encryption in progress check
Fix check in start encryption to disallow new encryption
setup while there is one already in progress.

Relates to commit 120eba45f81b ("Bluetooth: controller: Fix
start encryption in progress check").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-06 12:46:52 +01:00
Vinayak Kariappa Chettimada
7f0a95468a Bluetooth: controller: split: Fix data PDU leak during ctrl PDU defer
Fix a bug where in tx data PDU enqueued, while a ctrl PDU is
deferred due to Encryption setup being in progress, is
leaked causing HCI Tx Buffer Overflow crash.

Relates to commit 671ccc4b0ee6 ("Bluetooth: controller: Fix
data PDU leak during ctrl PDU defer").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-06 12:46:52 +01:00
Vinayak Kariappa Chettimada
d8928d7952 Bluetooth: controller: split: Fix DLE during data transmission
Fix bug in Data Length Update procedure that caused the
connection to drop due to the implementation sending bigger
PDU before the peer has acknowledged the receipt of Length
Response PDU.

Relates to commit ffbbec7a89ca ("Bluetooth: controller: Fix
DLE during data transmission").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-06 12:46:52 +01:00
Ioannis Glaropoulos
46b728204e bluetooth: controller: nrf5: use nrfx function to get CCM IRQ line
We use the nRFx API nrf_get_irq_number(.) to retrieve the IRQ
line of the CCM peripheral, instead of the hard coded enum
value from MDK. We do this for portability, since these
enums may be different for different nRF SoC series.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-05 16:42:15 +01:00
Vinayak Kariappa Chettimada
709dee5ed0 Bluetooth: controller: split: Fix conditional compile error
Fix conditional compilation error in building the central
only samples as all peripheral structure member accesses in
the controller where not correctly compiled out.

Regression introduced in commit 6d8b12468e ("Bluetooth:
controller: split: Refactor LLL conn structure").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-05 11:22:38 +01:00
Ulf Magnusson
bd6e04411e kconfig: Clean up header comments and make them consistent
Use this short header style in all Kconfig files:

    # <description>

    # <copyright>
    # <license>

    ...

Also change all <description>s from

    # Kconfig[.extension] - Foo-related options

to just

    # Foo-related options

It's clear enough that it's about Kconfig.

The <description> cleanup was done with this command, along with some
manual cleanup (big letter at the start, etc.)

    git ls-files '*Kconfig*' | \
        xargs sed -i -E '1 s/#\s*Kconfig[\w.-]*\s*-\s*/# /'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-04 17:31:27 -05:00
Ioannis Glaropoulos
73483094da bluetooth: controller: nrf5: simplify preprocessor conditionals
We make a minor simplification in the way we define
RADIO_PDU_LEN_MAX in Nordic nRF LE radio driver; as
nRF51 SoC series is the only series where the LL PDU
max length representation is limited to a 5-bit field,
we simplify the conditional preprocessor expression,
to avoid having to list all nRF5x SoCs with PDU LEN
MAX is represented by an 8-bit integer field.

In addition, we modify the preprocessor conditional,
that compiles in the CCM support for 8-bit length field,
PDUs to be an #ifndef CONFIG_SOC_SERIES_NRF51X, instead
of #ifdef CONFIG_SOC_COMPATIBLE_NRF52X; this will
simplify the expression when adding nRF53X series
support.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-04 17:14:06 +01:00
Vinayak Kariappa Chettimada
eed51cc018 Bluetooth: controller: split: Fix missing terminate_ack initialization
Add the missing initialization of master role terminate_ack
flag. This caused slave initiated remote termination as
procedure timeout.

Fixes #20135.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-04 10:44:59 +01:00
Vinayak Kariappa Chettimada
6d8b12468e Bluetooth: controller: split: Refactor LLL conn structure
Refactor the LLL connection context to move out the member
fields not accessed in LLL execution context.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-04 10:44:59 +01:00
Morten Priess
ca5c829a84 bluetooth: controller: Move calculation of max_tx_octets to ULL
Move calculation of max_tx_octets from Nordic lll_conn.c to ULL, to
allow usage by other vendors and prevent duplicate code.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-11-02 11:15:44 +01:00
Morten Priess
89ab68f242 bluetooth: controller: Vendor specific ticker resolution margin
With sub-microsecond resolution in ticker, it is not necessary to add a
precision margin to the conn_offset. A macro is created to allow setting
the margin to something other than the hard coded 2 * EVENT_JITTER_US.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-11-02 11:14:38 +01:00
Morten Priess
b631cc09ab bluetooth: controller: Add vendor specific overhead to TX buffer size
TX pdu buffers may need to be augmented for fragmentation or other
purpose, depending on vendor LLL implementation. Introduced define to
add extra bytes to TX buffer size, defaulting to 0 if unused.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-11-01 17:54:29 +01:00
Solveig Fure
aefe941396 bluetooth: controller: Remove condition for header inclusion
Remove ifdef guard around inclusion of nrf_clock_control.h in bluetooth
controller as the defines in this header are needed anyway.

Signed-off-by: Solveig Fure <solveig.fure@nordicsemi.no>
2019-10-28 16:24:51 +01:00
Carles Cufi
8c2b849ae7 Bluetooth: hci: Fix Create Connection Cancel assert
Since the LE (Enhanced) Connection Complete that comes as part of
cancelling a connection does not come through the priority rx thread in
hci_driver.c, the event class was not being calculated and cached.
Hence, calculate and cache the class whenever an event is received as
part of invoking a command.

Fixes #20110.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-10-24 20:33:59 +02:00
Vinayak Kariappa Chettimada
09088d856f Bluetooth: controller: split: Fix conn RSSI initial value
On connection callback generated by host, application
reading the RSSI value by using HCI LE Read RSSI Command
received -127 dB as the first connection event has not
occured yet in order to measure the RSSI value.

Fix this by using the RSSI value of received advertising
PDU by the initiator, and using the RSSI value of the
received CONNECT_REQ PDU by the connectable advertiser as
the initial value at connection setup.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-22 13:19:26 +02:00
Vinayak Kariappa Chettimada
4cc3cab9c7 Bluetooth: controller: legacy: Fix conn RSSI initial value
On connection callback generated by host, application
reading the RSSI value by using HCI LE Read RSSI Command
received -127 dB as the first connection event has not
occured yet in order to measure the RSSI value.

Fix this by using the RSSI value of received advertising
PDU by the initiator, and using the RSSI value of the
received CONNECT_REQ PDU by the connectable advertiser as
the initial value at connection setup.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-22 13:19:26 +02:00
Vinayak Kariappa Chettimada
9c14567ce2 Bluetooth: controller: Fix conn update to be cacheable
Fix connection update procedure to be cacheable if any other
local or remote control procedure is in progress.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-22 13:18:56 +02:00
Vinayak Kariappa Chettimada
fcd9612016 Bluetooth: controller: split: Fix incorrect MD bit value
MD bit was set based on whether a memq link's next pointer
being NULL, instead the check should be that the  memq has
more elements.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-21 13:01:26 +02:00
Vinayak Kariappa Chettimada
8ada121b68 Bluetooth: controller: split: Fix slave latency enable
Fix regression in porting slave latency, slave latency
enabled was not used, cause slave latency to be applied
before first packet being acknowledged by the master.

Regression in commit 5dff214d57 ("Bluetooth: controller:
split: Fix missing slave latency impl.").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-21 10:21:30 +02:00
Ulf Magnusson
72fb847a25 bluetooth: kconfig: Remove unused BT_CTLR_LOWEST_PRIO symbol
Added in commit 1475402d41 ("Bluetooth: controller: Introduce ULL LLL
architecture"), then never used.

Found with a script.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-18 19:43:47 +02:00
Vinayak Kariappa Chettimada
3d4aef8f99 Bluetooth: controller: split: Stop pre-empt timer
Add pre-empt timer stop when a prepare is executed so that
when the pipeline has another event queued, the firing of
the pre-empt timer does not pre-empt the just executed
prepare.

Relates to #19685.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-16 16:00:36 +02:00
Vinayak Kariappa Chettimada
4d4fb8e301 Bluetooth: controller: split: Fix ticks slot used on conn update
Fix incorrectly calculated ticks slots for a connection on
connection update. The reservation incorrectly included the
prepare offset.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-15 16:04:05 +02:00
Vinayak Kariappa Chettimada
fca32e41e6 Bluetooth: controller: Fix DLE for remote unsupported Coded PHY
Fix Data Length Procedure to use Feature Exchange values to
send correct parameters based on whether Coded PHY is
supported by remote peer.

Relates to BT TS.5.1.1 tests:
LL/CON/MAS/BV-129-C
LL/CON/MAS/BV-130-C
LL/CON/SLA/BV-132-C
LL/CON/SLA/BV-133-C

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-15 13:26:29 +02:00
Vinayak Kariappa Chettimada
af696bdd4c Bluetooth: controller: split: Fix ctrl proc rx node starvation
Rx nodes are reserved during control procedures for
generation of HCI event on completion. Fix the allocation
and reservation in the form of a linked list per connection
context. Worst case, this list will hold one rx node for
overlapping non-instant control procedure (Data Length
Update) plus two rx node for control procedure with instant
(PHY update with Data Length Update support).

Fixes #19198.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-14 11:25:10 +02:00
Carles Cufi
6c34983ed2 Bluetooth: controller: Handle remote version as a prio event
The remote version information event needs to be processed by the
prio_recv_thread() thread in order to unblock the Host RX thread
(effectively hci_driver's recv_thread()) when it blocks waiting for a
response to a remote version information.

Add the same time gate the inclusion of the feature behind a new Kconfig
option: CONFIG_BT_REMOTE_INFO.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-10-11 13:31:52 +02:00
Carles Cufi
b37be1c0c5 Bluetooth: controller: Introduce a new LLCP class
In order to be able to distinguish between connection-related events
that are generated by the controller and others genrated by LL control
procedures, introduce a new class for LLCP.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-10-11 13:31:52 +02:00
Carles Cufi
058724f329 Bluetooth: controller: Optimize calls to hci_get_class()
Cache the result of calling hci_get_class() to avoid repeatedly invoking
it on the same data. In order to cache it we take advantage of the fact
that both radio_pdu_node_rx_hdr and node_rx_hdr are not packed
structures and they currently have a spare padding byte (between type
and handle).

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-10-11 13:31:52 +02:00
Carles Cufi
9c32a6d287 Bluetooth: controller: hci: Obtain pdu_data using a macro
Hide the details of obtaining a pointer to the PDU data from a node_rx
structure to simplify the code.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-10-11 13:31:52 +02:00
Carles Cufi
db5e6f861d Bluetooth: controller: Further trim connection-related code
Conditionally compile additional code that is only relevant when
enabling connections.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-10-11 13:31:52 +02:00
Wolfgang Puffitsch
34b95feb54 Bluetooth: controller: split: Call LLL reset functions from ll_reset
Call LLL reset functions when calling ll_reset to avoid carrying LLL
state across HCI resets. Respective functions already exist in LLL but
had not been called from anywhere.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-10-11 08:58:33 +02:00
Vinayak Kariappa Chettimada
d12c53f89f Bluetooth: controller: split: Fix missing data len update event
Fix missing generation of data length update HCI event when
effective tx and rx timings change due to PHY update
procedure.

Fixes BT LL TS 5.1.0 test:
LL/CON/MAS/BV-52-C [Master Receiving Data, LE Coded, CI
Change]

Relates to #17097.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-10 12:13:54 +02:00
Vinayak Kariappa Chettimada
186a584d0a Bluetooth: controller: split: cond. compile job disable
When ULL High and ULL Low are not at same execution priority
level, it is not necessary to disable ULL Low execution when
updating ticker using stop and start. Also, ULL Low need not
be disable inside Radio Events. This commit corrects some of
the conditional compiles.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-10 12:12:47 +02:00
Vinayak Kariappa Chettimada
b71eb71de7 Bluetooth: controller: Fix Kconfig conditional optionals
Fix Kconfig conditional include of Minimum Channels Used
and Channel Selection Algorithm #2.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-09 15:53:14 +02:00
Wolfgang Puffitsch
537f06a532 Bluetooth: controller: split: Add hook for flushing in LLL
Add hook for flushing in LLL to allow clean-up of LLL-specific
resources.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-10-09 13:17:58 +02:00
Vinayak Kariappa Chettimada
d534492bf9 Bluetooth: controller: Fix ticker previous slot value
Fix ticker previous slot value with elapsed ticks value from
the time stopped ticker has expired. When a ticker is
stopped, if it was in its reserved time space, then the
currently occupied slot (was set to 0) should be the amount
of time that has elapsed in the expired and stopped ticker's
reserved time space and beyond until the stop.
This is required to ensure that any other new ticker does
not get scheduled over the stopped ticker's reserved time
space.

Fixes #19515.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-09 09:19:32 +02:00
Vinayak Kariappa Chettimada
a1945db08a Bluetooth: controller: Support Zero Latency IRQs
Add support for Zero Latency IRQs, which avoids any Zephyr
OS or application influenced ISR latencies on the
controller's ISRs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-09 09:19:18 +02:00
Vinayak Kariappa Chettimada
3096c0e741 Bluetooth: controller: split: Support Zero Latency IRQs
Add support for Zero Latency IRQs, which avoids any Zephyr
OS or application influenced ISR latencies on the
controller's ISRs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-09 09:19:18 +02:00
Vinayak Kariappa Chettimada
1e20009212 Bluetooth: controller: Add Zero Latency IRQ Kconfig
Add a Kconfig option to enable use of Zero Latency IRQs in
the controller.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-09 09:19:18 +02:00
Thomas Ebert Hansen
392d3a864a Bluetooth: controller: Fix endianness for length update.
Fix endianness when accessing length update parameters over HCI

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2019-10-08 11:38:55 +02:00
Morten Priess
90fabfd96b bluetooth: controller: Prevent unnecesary ticker "must expire"
When running a ticker node as "must expire", the node would invoke the
ticker callback even when programmed with latency. As "must expire" is
intended for scheduled events which are skipped due to collision, and as
such expected by LLL, purposefully skipped events should not generate
"must expire" callbacks.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-10-08 11:37:58 +02:00
Vinayak Kariappa Chettimada
786bed70ac Bluetooth: controller: split: Fix central_hr sample compilation
Fix ULL implementation that uses conditional compilation by
replacing back to use of #if defined(...) in code accessing
compiled out struct members.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 21:46:13 +02:00
Vinayak Kariappa Chettimada
1d00072bdc Bluetooth: controller: split: Fix flushing Tx buffers in ULL
Fix for possible Tx Buffer leak during disconnection when
the buffers are in ULL context and not yet enqueued towards
LLL context.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 20:29:29 +02:00
Vinayak Kariappa Chettimada
aa38b2298c Bluetooth: controller: split: Fix for Tx Buffer Overflow error
When more than one simultaneous connections are active,
transmitting data packets to peer, a termination causes
host to use the flushed pending number of completed packets
count for other active connections. This is on reception
of HCI disconnection complete event. But the controller has
not yet released any of the pending enqueued Tx buffers
which was happening after the disconnection event was
dispatched to HCI layer.

The fix here is to dispatch the disconnection complete event
from the LLL context after pending Tx buffers have been
flushed and the buffers get returned to Tx pool in the ULL
context. This way buffers are in the Tx pool before host
get to process the disconnection complete event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 20:29:29 +02:00
Vinayak Kariappa Chettimada
203b5859a1 Bluetooth: controller: split: Fix flushing Tx buffers in HCI
Fix for possible Tx Buffer leak during disconnection when
the buffers are in HCI thread context  and not yet demux-ed
and enqueued towards LLL context.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 20:29:29 +02:00
Vinayak Kariappa Chettimada
7d49726498 Bluetooth: controller: split: Fix LLL Tx flush to be immediate
Fix the mayfly scheduling of the Tx buffer flushing on
connection termination to be immediate (not to tailchain).

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 20:29:29 +02:00
Krzysztof Chruscinski
ec6b7e780b bluetooth: controller: Align nrf link layer to new clock control API
Align to use clock_control_get_status for blocking clock start.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-10-04 17:15:39 +02:00
Joakim Andersson
4d59ef306b Bluetooth: controller: Check if enc procedure is in progress
Check if the encryption procedure is in progress when receiving
rejection for the procedure.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-10-04 15:10:45 +02:00
Joakim Andersson
4135fb55f1 Bluetooth: controller: Fix rejected enc procedure not terminated
Fix issue in the handling of LL_REJECT_EXT_IND packets, this would look
at the procedures that are enqueued, and not the procedure that was
being rejected. This meant that although a reject was received for the
encryption procedure, the handling for a different control procedure was
run.
This would result in the link being terminated as control procedure
timer would time out for the encryption procedure.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-10-04 15:10:45 +02:00
Vinayak Kariappa Chettimada
6f7f5153db Bluetooth: controller: split: Fix radio abort race condition
When aborting radio event, there is a possibility that the
packet timer would start the radio while the packet timer
is being reset. Hence, perform a second radio state disable
with packet timers uninitialised.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 12:44:46 +02:00
Vinayak Kariappa Chettimada
20e385e675 Bluetooth: controller: split: Fix missing radio status reset
Fix missing radio status and configurations reset on radio
event abort. This caused under race conditions the radio
being put into active state after being aborted.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 12:44:46 +02:00
Vinayak Kariappa Chettimada
8d8d6a7608 Bluetooth: controller: split: Fix incorrect mayfly caller id
Fix incorrect ticker/mayfly user id used in scheduling the
abort of a radio event. Incorrect use of thread context as
the caller caused the abort function to be scheduled from
thread context while being called from ULL high context
level in reality. This could cause corruption of mayfly
scheduling.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 12:44:46 +02:00
Vinayak Kariappa Chettimada
848015854a Bluetooth: controller: split: Fix flash driver co-operation
When flash driver requests abort of radio event in unreserved
time space, resume radio events in the pipeline were not
flushed. These resumed events caused flash driver to assert
on the check whether radio was in use.

Fixed by flushing the pipeline of all radio events, resume
and also those events in pipeline with pre-empt timeout
being setup.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 12:44:46 +02:00
Vinayak Kariappa Chettimada
9d6c170e22 Bluetooth: controller: split: Fix advertising for multiple peripherals
When multiple simultaneous peripheral connections are
supported, restarting connectable advertising by host on
peripheral connection establishment failed in controller.
This prevented establishing new connections while first
connection was active.

The failure was caused by a bug in the way controller was
using quota for Rx PDU buffers. As the quota count was
release before the connection complete event rx PDU buffer
being released, the Rx PDUs needed to reserve for
connection complete event for new connectable advertising
was not available. This caused the connectable advertising
enable to fail.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 12:44:00 +02:00
Vinayak Kariappa Chettimada
5dff214d57 Bluetooth: controller: split: Fix missing slave latency impl.
Port the missing slave latency implementation from legacy
controller.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 12:43:24 +02:00
Wolfgang Puffitsch
799b46e35e Bluetooth: controller: Use entropy driver directly in bt_rand
Use entropy driver directly in bt_rand instead of stitching together
calls to sys_rand32_get to improve efficiency. The use of
sys_rand32_get could also leak timestamps into keys.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-10-02 13:21:24 +02:00
Morten Priess
70cbf342ff bluetooth: controller: RX PDU meta data support in LLL
Added support for vendor specific meta data in LLL node_rx_hdr. This
enables vendors to add "footer" data to the RX PDU, for supporting
specialized BLE features.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-10-02 13:20:50 +02:00
Joakim Andersson
3920844842 Bluetooth: Host: Fix usage of re-using Bluetooth log buffers
Fix calling bt_hex and bt_addr_le_str multiple times in the same logging
call could result in string overwritten since log_strdup is not
guaranteed to duplicate the string buffer in all logging configurations.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-09-30 17:47:43 +02:00
Morten Priess
c1038de6e8 bluetooth: controller: Add vendor operations to TICKER_USER_ULL_HIGH_OPS
Added to allow vendor specific increase of user operation capacity for
ULL_HIGH, to support queuing additional ticker operations.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-09-30 13:04:17 +02:00
Morten Priess
cd07fe94d6 bluetooth: controller: Use ticker must_expire to ensure ADV timing rand
Enabled use of ticker must_expire feature for ensuring ADV timing
randomization, even when ADV doesn't get air-time. This reduces ADV
collisions. Not active for nRF51 platform for now.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-09-30 12:52:52 +02:00
Morten Priess
5ce4df2a67 bluetooth: controller: Connection meta property support in LLL
Added support for vendor specific meta data in LLL conn object. This
enables vendors to add state data to connection, for supporting
specialized BLE slave features.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-09-30 12:52:33 +02:00
Vinayak Kariappa Chettimada
c38e2ee61a Bluetooth: controller: Fix refactored SWI regression
Fix regression introduced in refactoring of use of SWI.
Reduced use of SWI cannot be used in combination with
CONFIG_BT_CTLR_LOW_LAT as additional SWI is required
to split ticker WORKER and JOB contexts in order to
disable JOB but keep WORKER enabled.

Regression introduced in commit 78b461ae3e ("Bluetooth:
controller: Refactor use of SWI").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-30 12:25:10 +02:00
Vinayak Kariappa Chettimada
571809009e Bluetooth: controller: Fix legacy for TICKER_COMPATABILITY_MODE
When not using ticker compatibility mode in legacy
controller, ticker job should not be disabled inside radio
events.

Ticker compatibility mode was introduced in
commit 3a9173afe1 ("bluetooth: controller: Revised ticker
for improved conflict resolution").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-25 11:53:38 +02:00
Andrzej Głąbek
35754375bc soc: nordic: Get rid of nrf_common.h
This file contains redundant definitions of a bunch of nRF IRQ numbers
(not all, however) that only generates confusion, as enumeration values
provided by MDK can be used instead.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-09-24 16:20:16 +02:00
Andrzej Głąbek
57c6cfc9cd nordic: Use hal/ in all inclusions of nrfx HAL header files
Header files of nrfx HALs are not supposed to be included directly
but only with their names prepended with the hal/ directory (so that
an inclusion of an nrfx HAL header clearly differs from an inclusion
of an nrfx driver header).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-09-24 16:20:16 +02:00
Vinayak Kariappa Chettimada
f965b9c685 Bluetooth: controller: Fix DLE event on PHY update
Fix HCI Data Length Update event generation on PHY update
procedure, i.e. preserve Data Length Parameters on PHY
update.

Fixes BT LL.TS.5.1.1 tests:
LL/CON/MAS/BV-126-C
LL/CON/MAS/BV-127-C
LL/CON/SLA/BV-129-C
LL/CON/SLA/BV-130-C

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-24 10:37:44 +02:00
Vinayak Kariappa Chettimada
5ef52da005 Bluetooth: controller: Fix mayfly optimization
Fix incorrect reset of mayfly pended flag. This fix reduces
CPU use by mayfly.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-24 10:37:23 +02:00
Ioannis Glaropoulos
3bf872110d bluetooth: controller: nRF52811: fix LE Coded S2 Radio Timings
The nRF52811 Radio is similar to nRF52840 and exhibits
similar Radio Timings constants. We align the LE Coded
PHY (S2) RX chain delay with that of nRF52840, which,
eventually fixes the TIFS for nRF52811. In nRF52840 we
correct the inline comment only.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-24 09:02:15 +02:00
Vinayak Kariappa Chettimada
3202f91748 Bluetooth: controller: Fix to reject invalid enable command
Fix to reject invalid advertise and scan enable commands.

Fixes BT HCI.TS.5.1.1 tests:
HCI/DDI/BI-06-C
HCI/DDI/BI-07-C

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-24 08:15:56 +02:00
Vinayak Kariappa Chettimada
0ef062407c Bluetooth: controller: split: Fix to reject invalid enable command
Fix to reject invalid advertise and scan enable commands.

Fixes BT HCI.TS.5.1.1 tests:
HCI/DDI/BI-06-C
HCI/DDI/BI-07-C

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-24 08:15:32 +02:00
Ioannis Glaropoulos
5692ee17ed bluetooth: controller: replace SOC_NRF52840 in ifdef blocks for Coded
We have introduced option HAS_HW_NRF_RADIO_BLE_CODED, which
reflects that an nRF SoC has a Radio with LE Coded PHY
capabilities. We now modify all #ifdef expressions for
Coded PHY in the nRF controller port, removing SOC_NRF52840
and adding this new option instead. This allows to build
an nRF controller with Coded PHY support for SOCs other
than nRF52840.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-23 10:50:01 +02:00
Ioannis Glaropoulos
b2809ff769 bluetooth: controller: enable Coded PHY support for nRF52811
Nordic nRF52811 SoC has a 2.4GHx Radio which supports
LE Coded PHY, so we add the option to build a BLE
Controller for nRF52811 platforms with LE Coded PHY
support.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-23 10:50:01 +02:00
Vinayak Kariappa Chettimada
bfd393ac62 Bluetooth: controller: legacy: Ensure that a case statement is present
When compiling a sample like a beacon, none of the `if defined()`
statements in the switch case are actually compiled in, so the compiler
complains of an orphan mem_release();break; sequence.
Add a type that we know will always be compiled in in order to avoid
this issue.

Relates to commit 76bfea7cf9 ("Bluetooth: controller: Ensure that a
`case` statement is present").

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-18 20:56:43 +02:00
Vinayak Kariappa Chettimada
28f46131b3 Bluetooth: controller: split: Fix Rx reserved for conn cmplt
When both central and peripheral are supported, one each Rx
node will be needed by connectable advertising and the
initiator to generate connection complete, hence
conditionally set the count.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-16 21:46:35 +02:00
Vinayak Kariappa Chettimada
78b461ae3e Bluetooth: controller: Refactor use of SWI
Refactor to abstract the use of software interrupts in nRF5
Series.

Also, reduce the number of SWI used when interrupt priority
level configured is same for ULL High and ULL Low contexts.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-16 19:06:51 +02:00
Ioannis Glaropoulos
ee85f248fc bluetooth: controller: abstract PPI handling for LE Coded
This commit completes the refactoring of radio.c, so it
calls abstract functions for PPI handling for LE Coded
PHY (e.g. enable, disable channels, or configure endpoints),
which, then, call the platform-specific functions for PPI
handling. The abstract functions are simple wrappers,
implemented in radio_nrf5_ppi.h, conditionally, if we
build the controller with support for LE Coded PHY.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-16 19:06:51 +02:00
Ioannis Glaropoulos
f754ee4aa8 bluetooth: controller: conditionally define macros for LE Coded PHY
Make the definitions of LE Coded PHY-specific macros
and inline functions conditional, i.e. only if we
actually build the controller with support for LE
Coded PHY.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-16 19:06:51 +02:00
Ioannis Glaropoulos
dc3e9b1755 bluetooth: controller: abstract PPI handling functions
This commit refactors radio.c, so it calls abstract functions
for PPI handling (e.g. enable, disable channels, or configure
endpoints), which, then, call the platform-specific functions
for PPI handling. The abstract functions are simple wrappers,
implemented in radio_nrf5_ppi.h.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-16 19:06:51 +02:00
Ioannis Glaropoulos
d72d4f356d bluetooth: controller: define generic macros for LLL, ULL LOW IRQs
This commit defines generic macros for the software interrupt
(SWI) IRQ lines that are used for LLL and ULL LOW interrupts.
This is done for both the cases of the legacy and new (split)
controller architectures. In addition, it abstracts some of
the functionality around software-IRQ signals, to generic
functions, which have platform-specific implementations.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-16 19:06:51 +02:00
Kristoffer Rist Skøien
c58af2b686 Bluetooth: Controller: Typo in Kconfig
Changed documentation in Bluetooth Controller
Kconfig for BT_CTLR_ASSERT_HANDLER

Signed-off-by: Kristoffer Rist Skøien <kristoffer.skoien@nordicsemi.no>
2019-09-10 08:32:02 -05:00
Stephanos Ioannidis
9b0e738e37 bluetooth: controller: Explicitly include toolchain.h.
This commit adds an explicit inclusion of toolchain.h from pdu.h.

The endianness preprocessor definitions (__BYTE_ORDER__,
__ORDER_LITTLE_ENDIAN__, __ORDER_BIG_ENDIAN__) are used by pdu.h;
these being not defined can easily go unnoticed and cause unexpected
behaviours, as detailed in PR #18922.

toolchain.h ensures that these preprocessor definitions are defined and
*must* be included in a file that uses these definitions.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2019-09-09 21:40:54 +02:00
Morten Priess
d62ad4117c bluetooth: controller: Added function to support RX link quota update
Added ll_rx_link_inc_quota to allow vendor to manipulate
mem_link_rx.quota_pdu when cleaning up nodes via ull_vendor.h.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-09-08 12:39:09 +02:00
Vinayak Kariappa Chettimada
a28eba9897 Bluetooth: controller: Fix data PDU leak during ctrl PDU defer
Fix a bug where in tx data PDU enqueued, while a ctrl PDU is
deferred due to Encryption setup being in progress, is
leaked causing HCI Tx Buffer Overflow crash.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-07 17:10:22 +02:00
Vinayak Kariappa Chettimada
af5bcf354a Bluetooth: controller: Fix start encryption in progress check
Fix check in start encryption to disallow new encryption
setup while there is one already in progress.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-07 17:10:22 +02:00
Vinayak Kariappa Chettimada
7872b733d1 Bluetooth: controller: Fix Re-encryption procedure
Fix MIC failure on re-encryption procedure when responding
at the same time to peer initiated feature request.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-07 17:10:22 +02:00
Vinayak Kariappa Chettimada
46d5554664 Bluetooth: controller: Fix ENC_REQ PDU retransmission
Fix dropped ENC_REQ PDU when retransmitting, if slave was
not listening or nack-ed it.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-07 17:10:22 +02:00
Vinayak Kariappa Chettimada
6991d09977 Bluetooth: controller: Fix control tx queue handling
Fix control tx queue handling to correctly pause control PDU
responses during encryption setup.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-07 17:10:22 +02:00
Vinayak Kariappa Chettimada
1d978e8856 Bluetooth: controller: Add data length procedure queueing
Added implementation to cache Data Length Procedure when
another control procedure is in progress.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-07 17:10:22 +02:00
Vinayak Kariappa Chettimada
2e365424f0 Bluetooth: controller: Defer encryption setup if in conn update
Workaround, defer peer initiated encryption while local
initiated procedure with instant is not complete. Peer
master has sent CONN_UPDATE_IND in response to
CONN_PARAM_REQ, and also has initiated a Encryption Setup
thereafter. In this case, avoid corruption of the connection
update context by deferring the Encryption Setup.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-07 17:10:22 +02:00
Vinayak Kariappa Chettimada
3f695f7823 Bluetooth: controller: Fix cmd disallowed and collision disconnects
Fix implementation to correctly cache the control procedures
initiatable by local and peer. And, fix feature exchange and
version information procedures from being disallowed by
having then as cached requests to the controller.

Relates to #15256.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-07 17:10:22 +02:00
Ioannis Glaropoulos
1d45a2fe77 bluetooth: controller: minor fixes in inline comments
Several minor fixes to inline comments of #ifdef .. #endif
blocks.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-07 14:18:36 +02:00
Ioannis Glaropoulos
98356a14b7 bluetooth: controller: remove redundant header inclusions
nrf_timer.h and nrf_ppi.h are included by including
radio_nrf5.h, so we do not need to include them in
radio.c.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-07 14:18:36 +02:00
Vinayak Kariappa Chettimada
73bf27f243 Bluetooth: controller: split: Fix crash on terminate
Remove incorrect LL_ASSERT check in Lower Link Layer that
checked for invalid connection handle on reception of PDU.
The assert is not needed as PDUs can be received until the
Upper Link Layer is aware of the acknowledgement of the
terminate ind PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-03 13:56:12 +02:00
Vinayak Kariappa Chettimada
0d766c668d Bluetooth: controller: split: Fix PDU handling on terminate
Fix handling of Rx-ed PDU on termination, do not process
Rx-ed control PDUs and release the PDU buffer back to the
free pool.

Without this fix, Rx-ed control PDU was responded with a
Tx PDU, which did not get acknowledged or released.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-31 17:04:29 +02:00
Wolfgang Puffitsch
e8e668ae9c Bluetooth: controller: Fix endianness for length update.
Fix endianness when accessing length update parameters in PDU.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-08-28 13:03:39 +02:00
Vinayak Kariappa Chettimada
3f894250ef Bluetooth: controller: Fix Enc setup reset on rejection
Fix reset of Encryption Procedure state on reception of
REJECT_IND and REJECT_EXT_IND.

This is a regression in commit 79cb615770 ("Bluetooth:
controller: split: Port Enc setup to be queueable")

Relates to #18578.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-28 12:07:40 +02:00
Vinayak Kariappa Chettimada
385b82dcef Bluetooth: controller: split: Fix data pause on Enc Req enqueue
Fix the controller implementation to handle data packet
enqueue being pause on Encryption Request be done early in
the ULL when enqueueing packets towards LLL.

Fixes #18645.

Signed-off-by: Vinayak Kariappa Chettimada <vinayak.chettimada@gmail.com>
2019-08-27 15:13:38 +02:00
Erik Brockhoff
a4bd5b6835 bluetooth: controller: Fixing race re. adv disable in HDC
Re. issue "BT LL assert on LL/CON/ADV/BV-04-C #18584"

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2019-08-23 18:26:13 +02:00
Vinayak Kariappa Chettimada
1751648db0 Bluetooth: controller: split: Fix Enc setup reset on rejection
Fix reset of Encryption Procedure state on reception of
REJECT_IND and REJECT_EXT_IND.

This is a regression in commit 79cb615770 ("Bluetooth:
controller: split: Port Enc setup to be queueable")

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-22 16:40:46 +02:00
Vinayak Kariappa Chettimada
73f0fa3727 Bluetooth: controller: split: Tx cleanup and comments
Post Tx pool corruption fix, clean up code and add comments
explaining the use of Tx node next field used to indicate
the Tx node's allocation from Control or Data pool.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-22 14:34:04 +02:00
Vinayak Kariappa Chettimada
bdcec8418f Bluetooth: controller: split: Fix Tx FIFO, queue, and pool corruption
Fix the Tx FIFO, queue and pool corruption due to missing
release of link object to Tx link pool and hence missing
reset of the per connection initially allocated Tx link
free pointer.

The bug caused Tx PDUs and associated memory to be lost
leading to missing L2CAP segment transmissions. With lost
control PDU buffers, ULL would stall processing Done events
also leading to controller asserts.

Fixes #18546.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-22 14:34:04 +02:00
Vinayak Kariappa Chettimada
07460176ed Bluetooth: controller: split: Fix control flow issues
This fixes reported Coverity CID 203393 control flow issues.

Fixes #18381.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-20 14:17:26 +02:00
Morten Priess
69ff0f310e bluetooth: controller: Fix for uninitialized data compile error
Due to conditional compile path ending in LL_ASSERT(0), the compiler
sees code following the assert as using uninitialized variables.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-08-19 13:05:19 +02:00
Morten Priess
c635f4cb6d bluetooth: controller: Fix for coverity CID 203524
Fixes coverity issue: [Coverity CID :203524] Incorrect expression in
/subsys/bluetooth/controller/ticker/ticker.c #18382

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-08-19 11:26:20 +02:00
Carles Cufi
cb700d0e12 Bluetooth: controller: Disable AE by default
Disable Advertising Extensions by default, since they are not really
operational and they take RAM.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-08-15 15:07:12 +02:00
Carles Cufi
76bfea7cf9 Bluetooth: controller: Ensure that a case statement is present
When compiling a sample like a beacon, none of the `if defined()`
statements in the switch case are actually compiled in, so the compiler
complains of an orphan mem_release();break; sequence.
Add a type that we know will always be compiled in in order to avoid
this issue.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-08-15 15:07:12 +02:00
Vinayak Kariappa Chettimada
5d30d49f88 Bluetooth: controller: Fix ifdef block comment
Fix a minor incorrectly commented ifdef block.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-15 11:53:59 +02:00
Vinayak Kariappa Chettimada
3e0e378dca Bluetooth: controller: split: Fix pipeline for continuous events
Fix the pipeline prepare-resume implementation to correctly
handle multiple continuous events that request resume on
being pre-empted.

Symptoms of the bug being, when having continuous scanning,
and an active peripheral if a directed advertising is
started the peripheral event are not scheduled causing link
supervision timeout.

This is fixed by not having an enqueued resume event
prepared if there is an enqueued new non-resume event in the
pipeline.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-11 16:42:52 +02:00
Vinayak Kariappa Chettimada
d90f3db3bc Bluetooth: controller: split: Increase pipeline size
Increase pipeline size to accommodate probable multiple
prepare for directed advertising events, with reserved time
which are shorter than prepare duration, being enqueued.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-11 16:42:52 +02:00
Vinayak Kariappa Chettimada
e4ae7b8818 Bluetooth: controller: split: Increase event start overhead time
Increase the event start overhead time to accommodate for
processing time for dequeueing pipeline in Upper Link Layer.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-11 16:42:52 +02:00
Vinayak Kariappa Chettimada
f6799ff57e Bluetooth: controller: split: Reduce event done queue size
Reduce the maximum number of pending event done elements by
decoupling it from the maximum pipeline elements.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-11 16:42:52 +02:00
Joakim Andersson
50b28c010d Bluetooth: controller: Fix assert in RPA timeout for advertiser
Fix assert in the RPA timeout when no resolving entry exists in the
resolving list, and the advertiser was requested to use a local IRK
to generate it's own address.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-08-07 20:49:49 +02:00
Morten Priess
3a9173afe1 bluetooth: controller: Revised ticker for improved conflict resolution
Changed ticker behavior to resolve conflicts in ticker_worker instead of
in ticker_job. This allows better real-time slot allocation, as well as
allowing callbacks even if ticker node doesn't get air-time (for audio
stream housekeeping). A priority property now also allows prioritizing
one ticker node over others.
Compatibility mode enables lagacy ticker behavior if needed.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-08-07 13:52:48 +02:00
Joakim Andersson
bd89cc3f4d Bluetooth: Controller: Fix privacy advertiser connect peer address type
Fix an issue with enhanced connection complete event raised by the
advertiser role. The advertiser reported that it has resolved the
the identity address of the peer, even when the peer is connecting
using it's identity address.
The host will not have the correct on-air address type i.e public.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-08-06 14:53:33 +02:00
Vinayak Kariappa Chettimada
09c1c9e800 Bluetooth: controller: Decorrelate address generation from resolution
Changes related to Bluetooth TSE 11068.

This is done because the current test suite does not issue
an LE Enable Address Resolution command anymore in RPA
generation tests. Makes sense now that the Bluetooth SIG has
agreed to completely decouple address resolution from
generation.

Fixes BT LL TS 5.1.0 test:
LL/SEC/ADV/BV-03-C [Privacy - Non-connectable Undirected
Advertising, Resolvable Private Address]

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-31 15:22:49 +02:00
Vinayak Kariappa Chettimada
20ccdab445 Bluetooth: controller: split: Fix pipeline prepare/resume loop
Fix the pipeline prepare or resume dequeue loop from
overflow. Fixes premature exit of dequeue of done FIFO
which caused the pipeline to overflow due to previously
placed done is not dequeued correctly and next event not
being put back into the pipeline.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-30 12:57:02 +02:00
Wolfgang Puffitsch
c5c3a46824 Bluetooth: controller: Settings for company_id and subversion_number.
Enable use of settings system in controller and introduce settings for
company_id and subversion_number.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-07-23 10:58:03 +02:00
Vinayak Kariappa Chettimada
6cf26b8fe6 Bluetooth: controller: Make ULL/LLL split the default
Make the Upper and Lower Link Layer split architecture
implementation of the controller as the default when
building Zephyr Bluetooth Low Energy controller support
in applications.

Noticeable missing feature (porting) in comparison to old
architecture implementation is, Advanced scheduling of
connection events.

The missing features will subsequently be submitted
upstream.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-22 14:23:42 +02:00
Vinayak Kariappa Chettimada
f4eb03c538 Bluetooth: controller: Rename BT_LL_SW to BT_LL_SW_LEGACY
Rename the controller Kconfig option BT_LL_SW to
BT_LL_SW_LEGACY in preparation towards switch to new Link
Layer implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-22 14:23:42 +02:00
Vinayak Kariappa Chettimada
60bf4da4aa Bluetooth: controller: split: Conditional compile LL Rx pool use
Conditional compile the use of Rx Pool used to dispatch ULL
context generated messages towards LL thread context, which
is presently only used in connections.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-22 12:34:49 +02:00
Vinayak Kariappa Chettimada
04f351ac0a Bluetooth: controller: Fix cond compile of DLU event generation
Fix the conditional compile of Data Length Update event
generation on PHY Update Procedure when Data Length
Extensions are not supported.

The regression was introduced in
commit 70a89876d0 ("Bluetooth: controller: Fix missing
data length update event")

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-18 14:20:32 +02:00
Vinayak Kariappa Chettimada
da431f2a7d Bluetooth: controller: split: Handle zero length L2CAP start frame
Added a fix to handle L2CAP start frame with payload length
of zero which otherwise sent zero length data start PDU on
air.

Relates to #17046.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-17 15:07:52 +02:00
Vinayak Kariappa Chettimada
a081e001b0 Bluetooth: controller: split: Fix PHY update proc symmetric rsp
Fix PHY update procedure to correctly handle master
requesting asymmetrical and slave symmetrical.

Fixes BT LL TS 5.1.0 conformance test:
LL/CON/MAS/BV-117-C [PHY Update Procedure - Master
Requests Asymmetrical, Slave Symmetrical]

Relates to #17097.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-17 14:46:49 +02:00
Vinayak Kariappa Chettimada
ae8628d089 Bluetooth: controller: split: Fix packet timing restrict reset
Fixed a bug related to missing reset of packet timing
restriction variable.

Fixes BT LL TS 5.1.0 test:
LL/CON/SLA/BV-55-C [Initiating PHY Update Procedure - Packet
Time Restrictions, LE Coded]

Related to #17097.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-17 14:45:49 +02:00
Wolfgang Puffitsch
845064bb31 Bluetooth: controller: hci: Add user hooks.
Add hooks for processing of HCI user events on the controller side.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-07-17 13:53:13 +02:00
Wolfgang Puffitsch
e54a7ba324 Bluetooth: controller: hci: Add some documentation for encode_control().
No functional change.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-07-17 13:53:13 +02:00
Vinayak Kariappa Chettimada
e0965fa53c Bluetooth: controller: Update Bluetooth version to 5.1
Update the Bluetooth HCI Version to 5.1.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-16 12:53:10 +02:00
Vinayak Kariappa Chettimada
6f2476caa1 Bluetooth: controller: Fix DLE during data transmission
Fix bug in Data Length Update procedure that caused the
connection to drop due to the implementation sending bigger
PDU before the peer has acknowledged the receipt of Length
Response PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-16 12:53:10 +02:00
Vinayak Kariappa Chettimada
35bbf148f2 Bluetooth: controller: Add deferred procedure complete event
Added implementation to defer procedure complete event until
actual on-air connection event instant.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-16 12:53:10 +02:00
Vinayak Kariappa Chettimada
b60fa21f93 Bluetooth: controller: Enable Fast Enc and RSSI features
Enable the Fast Encryption design and connection RSSI
measurement when CONFIG_BT_HCI_RAW is selected.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-16 12:53:10 +02:00
Vinayak Kariappa Chettimada
fa4b4932b9 Bluetooth: controller: Fix post DLE/PHY update event length
Fix the controller implementation to perform connection
event length reservation based on the completed Data Length
Update and/or PHY Update Procedure.

This fix with avoid states/roles from stepping on each
others event length. Connection would have supervision timed
out or have stalled data transmissions due to insufficient
reserved air time.

Relates to #15171.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-16 12:53:10 +02:00
Vinayak Kariappa Chettimada
70a89876d0 Bluetooth: controller: Fix missing data length update event
Fix missing generation of data length update HCI event when
effective tx and rx timings change due to PHY update
procedure.

Fixes BT LL TS 5.1.0 test:
LL/CON/MAS/BV-52-C [Master Receiving Data, LE Coded, CI
Change]

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-16 12:53:10 +02:00
Vinayak Kariappa Chettimada
dbb3c7f702 Bluetooth: controller: Fix packet timing restriction reset
Fixed a bug related to missing reset of packet timing
restriction variable.

Fixes BT LL TS 5.1.0 test:
LL/CON/SLA/BV-55-C [Initiating PHY Update Procedure - Packet
Time Restrictions, LE Coded]

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-16 12:53:10 +02:00
Vinayak Kariappa Chettimada
3f576360ae Bluetooth: controller: Fix PHY update proc symmetric rsp
Fix PHY update procedure to correctly handle master
requesting asymmetrical and slave symmetrical.

Fixes BT LL TS 5.1.0 conformance test:
LL/CON/MAS/BV-117-C [PHY Update Procedure - Master
Requests Asymmetrical, Slave Symmetrical]

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-16 12:53:10 +02:00
Vinayak Kariappa Chettimada
8401fda961 Bluetooth: controller: split: Fix continuous initiator
Fix the implementation of initiator to use correct anchor
tick and remainder microseconds when sending out CONNECT_REQ
PDU and then to scheduling the first connection event. This
is a fix when initiator is in continuous scan.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-15 16:11:06 +02:00
Vinayak Kariappa Chettimada
803739cd80 Bluetooth: controller: split: Fix incorrect CU under latency
Fix bug in the ported code of the connection update, when
the slave events are skipped due to other overlapping state
or role the connection update at the instant used wrong
latency calculations. This lead to connection disconnection.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-15 15:22:23 +02:00
Vinayak Kariappa Chettimada
ab69044310 Bluetooth: controller: Fix logging assert
Fix logging assertion by using bt_addr_le_str which uses
log_strdup().

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-12 13:37:47 +02:00
Vinayak Kariappa Chettimada
17b05526ba Bluetooth: controller: Fix assert during DLE
Fix assert in controller checking ticker_id_prepare = 0 when
a scanner and connection are active, and the connection is
skipping events in order to resize Rx buffers.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-10 14:10:37 +02:00
Vinayak Kariappa Chettimada
6d272a17f4 Bluetooth: controller: Move ticker_id_prepare reset to early return
Move the reset of ticker_id_prepare variable to the early
return in event_connection_prepare function.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-10 14:10:37 +02:00
Vinayak Kariappa Chettimada
a02151ebd4 Bluetooth: controller: split: Port radio event abort
Port the implementation that does radio event abort due to
ISR latencies. The implementation measures if the ISR could
not meet the hard real time deadline and closes the event
early.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-04 09:46:49 +02:00
Vinayak Kariappa Chettimada
3aa57808ac Bluetooth: controller: split: Add interface to get adv/scan handle
Added interface to get Advertiser and Scanner instance
handle for use in Lower Link Layer module.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-04 09:46:49 +02:00
Thomas Stenersen
d596262821 Bluetooth: controller: Rename assert handler Kconfig title
Renames the "Blueooth Controller Assertion Handler" to "Application
Defined Assertion Handler" to better fit the purpose of the Kconfig
option.

Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
2019-07-02 09:19:16 +03:00
Thomas Stenersen
3379b641b7 Bluetooth: controller: Remove BT_HCI_RAW dependency
Removes the dependency on BT_HCI_RAW from BT_CTLR_ASSERT_HANDLER.

Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
2019-07-02 09:19:16 +03:00
Johan Hedberg
0d9dab300e Bluetooth: Introduce separate pool for discardable events
Introduce a separate buffer pool for events which the HCI driver
considers discardable. Examples of such events could be e.g.
Advertising Reports. The benefit of having such a pool means that the
if there is a heavy inflow of such events it will not cause the
allocation for other critical events to block and may even eliminate
deadlocks in some cases.

Also update all mesh samples not to specify explicit RX buffer counts
anymore. Instead, create appropriate defaults in Kconfig so that we
only need to override this in the app for cases like the bbc:microbit
with limited memory.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-07-01 16:36:15 +03:00
Johan Hedberg
fc2fcd10cf Bluetooth: Add dedicated pool for HCI_Num_Completed_Packets HCI event
This event is a priority one, so it's not safe to have it use the RX
buffer pool which may be depleted due to non-priority events (e.g.
advertising events). Since the event is consumed synchronously it's
safe to have a single-buffer pool for it. Also introduce a new
bt_buf_get_evt() API for HCI drivers to simplify the driver-side code,
this effectively also deprecates bt_buf_get_cmd_complete() which now
has no in-tree HCI driver users anymore.

Fixes #16864

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-07-01 16:36:15 +03:00
Radu Alexe
f1c5586523 Bluetooth: controller: better field names
Fields nodes, users are arrays; therefore their names should be plural
to suggest that.

Signed-off-by: Radu Alexe <radu.alexe@nxp.com>
2019-06-28 11:09:25 +02:00
Anas Nashif
efb8df5366 cleanup: include/: move misc/stack.h to debug/stack.h
move misc/stack.h to debug/stack.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
a2fd7d70ec cleanup: include/: move misc/util.h to sys/util.h
move misc/util.h to sys/util.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
536dd5a71f cleanup: include/: move misc/slist.h to sys/slist.h
move misc/slist.h to sys/slist.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
9ab2a56751 cleanup: include/: move misc/printk.h to sys/printk.h
move misc/printk.h to sys/printk.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
1ed300b318 cleanup: include/: move misc/mempool_base.h to sys/mempool_base.h
move misc/mempool_base.h to sys/mempool_base.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
ee9dd1a54a cleanup: include/: move misc/dlist.h to sys/dlist.h
move misc/dlist.h to sys/dlist.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
5d001f3e41 cleanup: include/: move misc/byteorder.h to sys/byteorder.h
move misc/byteorder.h to sys/byteorder.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
969f8f1c68 cleanup: include/: move entropy.h to drivers/entropy.h
move entropy.h to drivers/entropy.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
17ddd1714c cleanup: include/: move clock_control.h to drivers/clock_control.h
move clock_control.h to drivers/clock_control.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
e1e05a2eac cleanup: include/: move atomic.h to sys/atomic.h
move atomic.h to sys/atomic.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Vinayak Kariappa Chettimada
a438e71460 Bluetooth: controller: Add PA/LNA support on NRF_P1 GPIO pins
Added support for using NRF_P1 GPIO pins on nRF52840 SoC.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-06-27 15:17:20 +02:00
Vinayak Kariappa Chettimada
4fe004ad87 Bluetooth: controller: Fix handling zero length L2CAP start frame
Added a fix handling L2CAP start frame with payload length
of zero which otherwise sent zero length data start PDU on
air.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-06-26 16:32:14 +02:00
Morten Priess
14537fee9d bluetooth: controller: Moved ull_entropy_get to LLL
Moved and renamed ull_entropy_get to lll_entropy_get, placed under
vendor specific ll_sw. This is needed for SW implemented entropy,
to allow vendor implementation of faster, less secure random number
generator for randomizing ADV timing.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-06-20 10:30:28 +02:00
Anas Nashif
f2cb20c772 docs: fix misspelling across the tree
Found a few annoying typos and figured I better run script and
fix anything it can find, here are the results...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-19 15:34:13 -05:00
David B. Kinder
2aebc980e2 doc: fix Kconfig misspellings
Fix misspellings in Kconfig files missed during regular reviews.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-06-18 15:07:52 -04:00
Morten Priess
b34db7fb71 bluetooth: controller: Reverted revised ticker pending redesign
Reversed revised ticker implementation pending new design which resolves
the issues described in GH issues #16830.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-06-18 14:20:52 +02:00
Vinayak Kariappa Chettimada
3e56c2cf16 Bluetooth: controller: split: Fix buffer leak on disconnect
Fix pending Tx control buffer leak on supervision timeout.
Queued tx buffers in LLL consists of both data and control
PDUs but only data buffers got correctly released.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-06-17 15:32:35 +02:00
Kumar Gala
a2693975d7 dts: Convert from DT_<COMPAT>_<INSTANCE>_<PROP> to DT_INST...
Change code from using now deprecated DT_<COMPAT>_<INSTANCE>_<PROP>
defines to using DT_INST_<INSTANCE>_<COMPAT>_<PROP>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-14 08:02:15 -05:00
Vinayak Kariappa Chettimada
802718a773 Bluetooth: controller: BT_CTLR_USER_EXT depends on BT_LL_SW_SPLIT
Make the Kconfig option BT_CTLR_USER_EXT depend on
BT_LL_SW_SPLIT.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-06-13 15:11:31 +02:00
Vinayak Kariappa Chettimada
dd3e8241e9 Bluetooth: controller: split: Port random slave event backoff
Port the implementation that performed random backoff of
forced slave event scheduling.

When peer master implementation skips events, multiple
local overlapping slaves will randomize their forced
scheduling to break out of a round robin pattern increasing
the chance of synchronizing with their masters again.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-06-13 14:13:36 +02:00
Morten Priess
8a92818c0a bluetooth: controller: Revised ticker for improved conflict resolution
Changed ticker behavior to resolve conflicts in ticker_worker instead of
in ticker_job. This allows better real-time slot allocation, as well as
allowing callbacks even if ticker node doesn't get air-time (for audio
stream housekeeping). A priority property now also allows prioritizing
one ticker node over others.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-06-13 13:12:26 +02:00
Joakim Andersson
f5d2d99762 Bluetooth: controller: Fix scan request when advertising directed
Fix scan requests being processed during directed advertisiments.
Directed advertise packets are not scannable

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-06-13 10:51:51 +02:00
Vinayak Kariappa Chettimada
3cf304fd95 Bluetooth: controller: split: Add ULL/LLL architecture assert checks
Add some missing fatal asserts that need to be caught to
avoid unexpected failures in the implementation of the
architecture.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-06-12 10:25:09 +02:00
Vinayak Kariappa Chettimada
3169556592 Bluetooth: controller: split: Fix tx_ack mfifo count
Fix the tx_ack mfifo count to accomodate both data and
control PDUs being acknowledged.

With out this fix, pending maximum number of data plus
control PDUs in LLL on supervision timeout asserted due to
tx_ack mfifo overflow.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-06-11 13:14:46 +02:00
Vinayak Kariappa Chettimada
23a6de5dd0 Bluetooth: controller: split: Port slave conn update assert fix
Explicitly track the connection update related ticker stop
and start to avoid asserting due to ticker update being done
at the same time for compensating the master clock drift.

Relates to #11764.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-06-11 11:09:38 +02:00
Vinayak Kariappa Chettimada
b11a0d35ee Bluetooth: controller: split: Add internal ull_update_mark func
Added an internal ull_update_mark function to detect race
conditions while stopping ticker instances during slave
drift, disconnection and connection update.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-06-11 11:09:38 +02:00
Vinayak Kariappa Chettimada
79cb615770 Bluetooth: controller: split: Port Enc setup to be queueable
Port the fix for the controller implementation to make start
encryption queueable if there is any control procedure in
progress.

Refer to #15335.
Relates to #15335, #15186, #15958 and #14636.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-06-06 10:34:13 +02:00
Asger Munk Nielsen
eb73a32bc1 Bluetooth: controller: Moved advanced settings in Kconfig
Moved some user defined Kconfig constants to advanced
settings menu.

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
2019-05-30 17:14:54 -04:00
Asger Munk Nielsen
8844b7f5a5 Bluetooth: controller: Enable use of user defined protocols
Implements hooks to implement user protocols in ull.c
A user defined init function can now be called, this code is gated by
the CONFIG_BT_CTLR_USER_EXT define.
A user defined PDU length can now also be defined using the Kconfig
CONFIG_BT_RX_USER_PDU_LEN

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
2019-05-30 17:14:54 -04:00
Vinayak Kariappa Chettimada
8de64fcb81 Bluetooth: controller: split: Fix shell app regression
Fix shell app regression due to stale tmp role implementation
not fully being removed in commit 4c77bf6194 ("Bluetooth:
controller: Remove redundant tmp role implementation").

The regression caused ticker indexes outside of allocations to
be accessed causing application faults and memory corruptions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-05-28 21:31:55 -04:00
Alexander Svensen
67de7ec86d Bluetooth: controller: split: Refactor if defines in lll_scan.c
This commit refactors if defines to use IS_ENABLED macro
for readability.

Signed-off-by: Alexander Svensen <alsv@nordicsemi.no>
2019-05-27 09:24:44 -04:00
Alexander Svensen
1c33d90fdb Bluetooth: controller: split: Refactor if defines in lll_adv.c
This commit refactors if defines to use IS_ENABLED macro
for readability.

Signed-off-by: Alexander Svensen <alsv@nordicsemi.no>
2019-05-27 09:19:06 -04:00
Joakim Andersson
34758e8349 Bluetooth: controller: Fix rx_ftr and extra overlapping memory
The the footer structure and extra bytes (rssi, resolving index etc.)
were overlapping in memory, rx_ftr was moved into the header, but the
extra and footer are still being read from the same place, extra was
written to the end. So this avoided memory corruption, but reading extra
reads wrong information.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-05-27 12:59:05 +02:00
Joakim Andersson
9e96df39f2 Bluetooth: controller: Fix compilation without broadcaster or observer
Fix compilation issues in central_hr or peripheral_hr sample when using
split LL and privacy is enabled.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-05-24 12:00:12 -04:00
Joakim Andersson
cecd7f8d70 Bluetooth: controller: Copy the connect_ind into node_rx
The node_rx buffer does not contain the data from the connect ind, so
copy it over.
Also back up the adv pdu chan_sel bit so that it can be used to properly
select the correct channel selection algorithm

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-05-24 12:00:12 -04:00
Joakim Andersson
6db4776980 Bluetooth: controller: Fix pdu being overwritten while in use
The node_rx buffer for the connect ind buffer is being reused to send
connection complete event, make sure all data is backed up before
reusing the buffer.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-05-24 12:00:12 -04:00
Joakim Andersson
65b3f17aa9 Bluetooth: controller: Fix initialization of rl_idx and rpa_gen
The privacy state variables rl_idx and rpa_gen was not initialized
properly, which results in connection failing to be established.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-05-24 12:00:12 -04:00
Vinayak Kariappa Chettimada
b928cef69c Bluetooth: controller: split: Port h/w privacy feature
Ported h/w based LL privacy to ULL/LLL split architecture.

Fixes #14675.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-05-24 12:00:12 -04:00
Vinayak Kariappa Chettimada
c5c87c38eb Revert "Bluetooth: controller: Disable controller privacy feature"
This reverts commit c629ea8a64.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-05-24 12:00:12 -04:00
Asger Munk Nielsen
69790e5c73 Bluetooth: controller: Enable use of proprietary rx demuxing functions
Code refactored to allow calling of a proprietary rx demux function.
This will enable implementation of proprietary protocols and
functionality that is not yet public, while keeping a common zephyr
code base.

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
2019-05-22 14:59:30 +02:00
Peter A. Bigot
ea6cad9b89 Bluetooth: controller: remove duplicated code
A conditional block to save a directed advertising report flag was
present three times.  Remove two of the blocks.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-05-21 21:42:01 -04:00
Alexander Svensen
63a93e8b5a Bluetooth: controller: split: Refactor if_defines to is_enabled in lll.c
This commit refactors if defines to use the macro is_enabled,
for readability

Signed-off-by: Alexander Svensen <alsv@nordicsemi.no>
2019-05-21 14:40:21 +02:00
Joakim Andersson
172dcec236 Bluetooth: controller: Fix unknown rsp received during enc procedure
Port fix for #14044 from legacy LL to split LL.

The master is using unknown rsp to terminate slave side initiated
procedures that has collided with the encryption procedure initiated by
the master.
We need to handle an unknown response that is sent in unencrypted during
the encryption procedure, even though we have already set up to receive
encrypted packets.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-05-15 10:10:42 +02:00
Joakim Andersson
289eab6ad5 Bluetooth: controller: Remove incorrect comment
Remove comment stating that UNKNOWN_RSP during encryption procedure
is a workaround.
The core spec mandates that connections should not be dropped if
receiving this control packet during encryption procedure.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-05-15 10:10:42 +02:00
Alexander Svensen
d9d85fd1d3 Bluetooth: controller: split: Refactor the lll_clock_wait() function
This is a pure refactoring of the k32src_wait function. It used the
following rules when refactoring:

Don't use the preprocessor when unprocessed C language suffices.

Don't undefine macro's.

Avoid global variables when possible.

Use consistent names for similiar things (hf_clock, lf_clock).

Signed-off-by: Alexander Svensen <alsv@nordicsemi.no>
2019-05-14 14:18:02 +02:00
Alexander Svensen
3d94df7e8e Bluetooth: controller: split: Fix master role RSSI measurement
Fix broken master role RSSI measurement. Since the original
contribution clean up into Zephyr, the radio shorts that was
set for measuring the RSSI for master role has been broken,
as it was cleared by the radio switching code further in the
Tx ISR.

Signed-off-by: Alexander Svensen <alsv@nordicsemi.no>
2019-05-14 14:08:11 +02:00
Asger Munk Nielsen
58e9ac6811 bluetooth: Controller: Refactor node_rx footer to avoid ptr arithmetic
The old footer was appended after PDU using pointer arithmetic. Now
the footer fields have been moved to the header struct, the
footer fields are now statically located in the data structure,
this is type safe and fields can be referred to by their actual
names rather than indirectly through reference to other members,
thus avoiding pointer arithmetic. Secondly, this change will pave
the way for adding other meta data in the future.

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
2019-05-14 10:56:16 +02:00
Jakub Rzeszutko
d9c18ff05e boards: arm: Add Nordic nRF52811 board
This commit adds support for board: nrf52811_PCA10056.

The nRF52840 DK: PCA10056 is the recommend development kit, it emulates
the nRF52811, and can be used as a starting point for development
before moving over to a custom board.

Please note that this development kit does not support Bluetooth
Direction Finding. What is more it cannot be used with most of Arduino
shields because of PCA10056 PIN layout.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-05-14 09:52:57 +02:00
Alexander Svensen
774d5e871c Bluetooth: controller: split: Fix Conn Param Req procedure stall issue
Fix an issue wherein local or remote initiated Connection
Parameter Request procedure would stall without generation
of LE Connection Update Complete HCI event because a local
or remote initiated PHY Update procedure has overwritten the
currently active Link Layer Control Procedure type.

Signed-off-by: Alexander Svensen <alsv@nordicsemi.no>
2019-05-08 11:21:52 +02:00
Mariusz Skamra
44739f4427 Bluetooth: controller: Workaround CPR procedure collision at CPU instant
This is a workaround for IOP issue, where peer rejects LLCP Slave
Connection Parameter Request with LMP Error Transaction Collision
error code even if previous request is complete at the instant.

Relates to #15366.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-05-07 23:17:34 -04:00
Vinayak Kariappa Chettimada
019d282ab2 Bluetooth: controller: Fix Enc Setup overlap with Length Update
Fix the encryption setup queueing implementation to avoid
overlapping with local initiated Length Update Procedure.

Fixes #15733.
Relates to #15335, and #15186.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-05-07 23:16:23 -04:00
Andrzej Głąbek
9a5cb2280e bluetooth: controller: hal: Correct the bit mask of used PPI channels
This is a follow up to commit 0eaa5e53a36af498115b4e56b1ea68cc89fc29ee.

`HAL_SW_SWITCH_RADIO_ENABLE_S2_PPI_BASE` is a base number for two PPI
channels, so two bits need to be marked in the used channel bit mask.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-05-07 11:12:01 +02:00
Carles Cufi
2a0a48f6bb Bluetooth: controller: hal: Fix PPI macro naming
Due to a protracted merge of:
5e38ed9320
the naming for the HAL_SW_SWITCH_RADIO_ENABLE_S2_PPI changed
semnatics, now requiring use of
HAL_SW_SWITCH_RADIO_ENABLE_S2_PPI_BASE.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-05-06 17:46:56 +02:00
Andrzej Głąbek
5e38ed9320 ext: nrfx: Reserve PPI channels and groups used by Bluetooth controller
Mark the PPI channels and groups used by the Bluetooth controller
as occupied and thus unavailable for allocation through nrfx_ppi.

Add also a build time assertion that checks if these PPI channels
do not overlap with those assigned to the pwm_nrf5_sw driver
(to replace the comments in this driver that were supposed to warn
about this threat but had in fact little chance to be read by users).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-05-06 15:25:44 +02:00
Alexander Svensen
e5cf9ce1f2 Bluetooth: controller: ull/lll: Do not feature exc more than once
Updated the controller implementation to not feature
exchange if already done once either by local or remote peer
device in an active connection session.

Signed-off-by: Alexander Svensen <alsv@nordicsemi.no>
2019-05-06 14:47:48 +02:00