Commit graph

789 commits

Author SHA1 Message Date
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Vinayak Kariappa Chettimada ba487feb0f Bluetooth: controller: split: Workaround nRF52832 CCM overrun
Implemented an intermediate decrypt buffer to cover the CCM
overrun under CRC error conditions. The workaround is
applicable to nRF52832 SoC only, which is missing the
MAXPACKETSIZE register in the NRF_CCM peripheral.

Fixes #21107 for nRF52832 SoC.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-05-29 13:12:28 +02:00
Vinayak Kariappa Chettimada cd7a73c20a Bluetooth: controller: split: Fix NRF_CCM overrun
Fix missing assignment of NRF_CCM->MAXPACKETSIZE register
for PDU sizes smaller than 251 bytes. If there is CRC errors
causing PDU length fields to be higher than configured PDU
buffer sizes in the controller, without the MAXPACKETSIZE
register set to correct PDU size, CCM module could overrun
the PDU buffer and cause memory corruption. This fix is
applicable for all nRF52 Series SoCs except nRF52832 SoC.

Fixes #21107.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-05-27 18:06:17 +02:00
Andries Kruithof 6a2f50aba2 Bluetooth: controller: split: Update feature exchange to BTCore V5.0
The existing feature exchange procedure does not give the proper
response as specified in the BT core spec 5.0.
The old behaviour is that the feature-response returns the logical and
of the features for both peers.
The behaviour implemented here is that the feature-response returns the
featureset of the peer, except for octet 0 which is the logical and of
the supported features.
Tested by using the bt shell, and having different featuresets
on the 2 peers.

This fixes #25483

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2020-05-26 14:34:39 +02:00
Vinayak Kariappa Chettimada 122c43562e Bluetooth: controller: split: Fix slave latency cancel race
Fix missing transmit buffer demutiplexing before checking if
slave latency needs to be maintained or cancelled.

This bug was detected when new transmit buffer was enqueued
overlapping with on-air radio transmission of empty PDU
preceding the handling of radio event done.

Symptoms of this bug being data transmission latency of upto
slave latency plus one times connection interval.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-05-15 17:07:33 +02:00
Carles Cufi b67a31e411 Bluetooth: controller: Remove legacy LL
Remove the legacy Link Layer implementation.

Closes #24187.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-08 15:07:00 +02:00
Mieszko Mierunski f93924c689 bluetooth: Add bluetooth support for nRF52820
This commit adds support for bluetooth in nRF52820 SoC.
Bluetooth radio related files created and added to Zephyr.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2020-05-08 15:00:41 +02:00
Morten Priess 3ed658e9ed Bluetooth: controller: Added support for vendor ticker nodes
With BT_CTLR_USER_TICKER_ID_RANGE it is possible for vendors to add a
number of ticker nodes for proprietary purposes. The feature depends on
BT_CTLR_USER_EXT.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2020-05-07 17:34:21 +02:00
Kumar Gala 8316818739 bluetooth: controller: openisa/RV32M1: Convert irqs to new dts macros
Convert old style defines for IRQ numbers to using DT_IRQN and
DT_NODELABEL to extract IRQ numbers.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-30 11:26:59 -05:00
Joakim Andersson eba6265ac3 Bluetooth: controller: Add BT_CTLR_CONN_RSSI_EVENT option
Split BT_CTLR_CONN_RSSI option into two, the base option enables the
Read RSSI command, while the new BT_CTLR_CONN_RSSI_EVENT enables the
connection RSSI events. There is no handling of RSSI events, only a
BT_INFO log.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-30 13:33:16 +02:00
Joakim Andersson 05e5db74cf Bluetooth: controller: Convert bluetooth controller to using k_timeout_t
Convert bluetooth controller to using the new k_timeout_t API so that
CONFIG_LEGACY_TIMEOUT_API can be turned off.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-30 13:46:48 +03:00
Joakim Andersson 578f2a582f Bluetooth: controller: Set local RPA field only when generated legacy
Fix local RPA field for the legacy controller. This failed without
compilation errors because of blind pointer cast between two
structs of similar definition.
Set the local RPA field of the enhanced connection complete event only
when the address was generated by the controller. If the host has
set an RPA and this one was used the controller should return all
zeroes.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-27 19:02:48 +02:00
Joakim Andersson e9b39cd304 Bluetooth: controller: Set local RPA field only when generated
Set the local RPA field of the enhanced connection complete event only
when the address was generated by the controller. If the host has
set an RPA and this one was used the controller should return all
zeroes.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-27 19:02:48 +02:00
Alex Porosanu 4c4f07e0dc bluetooth: controller: openisa: Fix densely scheduled event preemption
This is a rework for OpenISA SW LL of
"b7220cef86 Bluetooth: controller: split: Fix densely scheduled event
preemption"

Fix LLL implementation handling preemption of currently
active radio event with densely scheduled events in the
pipeline.

Preempt timeout was stopped without consideration to there
being more queued events in the pipeline. Also, added
chaining of preemption timeouts one after the other expiry
so as to preempt currently active events by the densely
scheduled events in the pipeline.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
2020-04-27 11:31:31 +02:00
Alex Porosanu 678f0296c8 bluetooth: controller: openisa: Reduce time to setup tIFS switch
This is a rework for OpenISA SW LL of
"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>
Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
2020-04-27 11:31:31 +02:00
Alex Porosanu d6710257bd bluetooth: controller: openisa: handle latency for cancelled conn events
This is a rework for OpenISA SW LL of
"4547bfb452 Bluetooth: controller: split: handle latency for cancelled
conn events" as well as subsequent fixes

Update implementation of master and slave LLL's to correctly
handle event counter values when latencies introduced due to
connection events cancelled by active events operating in
unreserved time space.

When an active radio event extends into unreserved time
space, and a connection event prepare is scheduled but at
the time of pre-emption timeout if the connection event is
cancelled then the event count and latencies needs to be
continiued to get acummulated.

In the current controller usecases the above scenarios does
not get exercised, the changes in this commit is needed for
future roles that can extend into unreserved time space and
would cancel a scheduled connection event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
2020-04-27 11:31:31 +02:00
Alex Porosanu e08ceec584 bluetooth: controller: openisa: fix assert on invalid packet sequence
This is a rework for OpenISA SW LL of
"62c1e1a52b Bluetooth: controller: split: Fix assert on invalid packet
sequence"

Fix to remove assertion failure check on detecting invalid
packet sequence used by peer central and that no non-empty
packet was transmitted.

Fixes #22967.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
2020-04-27 11:31:31 +02:00
Kumar Gala e241de8a31 bluetooth: controller: openisa/RV32M1: Convert DT_ALIAS to NODELABEL
Use the new DT_NODELABEL macro instead of aliases to get the specific
gpios ports.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-20 15:52:30 -05:00
Jeanina Dragusin 6099e0f928 bluetooth: controller: openisa/RV32M1: add RPA support
The radio on the VEGA platform will now be able to resolve Resolvable
Private Addresses through the use of the CAUv3 hardware. With this
patch the RPA feature is now fully supported on the Controller:
RPA addresses are generated with local IRK and resolved with
previously exchanged peer IRK.

Signed-off-by: Jeanina Dragusin <ancajeanina.dragusin@nxp.com>
2020-04-15 13:43:00 -05:00
Kumar Gala 43a7d26603 drivers: entropy: replace CONFIG_ENTROPY_NAME with DT macro
Replace CONFIG_ENTROPY_NAME with DT_CHOSEN_ZEPHYR_ENTROPY_LABEL.  We now
set zephyr,entropy in the chosen node of the device tree to the entropy
device.

This allows us to remove CONFIG_ENTROPY_NAME from dts_fixup.h.  Also
remove any other stale ENTROPY related defines in dts_fixup.h files.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-13 09:14:21 -05:00
Andries Kruithof aafd563195 Bluetooth: controller: legacy: Correct DLE time calculations
This PR fixes #23482. The preamble size for a 2M phy was incorrect.

There is a bug in calculation of time for the DLE procedure:
the preamble size is incorrect for the 2M phy

Fixes #23482

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2020-04-09 14:55:20 +02:00
Kumar Gala 60541af791 Bluetooth: controller: specify entropy device explicitly
For the ll code we know the exact entropy device as its the one for the
SoC that we are on.  So use the new DT macro's to get the entropy device
via DT_INST rather than using CONFIG_ENTROPY_NAME.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-07 13:07:45 -05:00
Carles Cufi 205cf1595e boards: nrf52810_pca10040: Rename to nrf52dk_nrf52810
The board target for emulation of nRF52810 on nRF5DK, so far
known as nrf52810_pca10040, is renamed to nrf52dk_nrf52810.
Its documentation and all references to its name in the tree are
updated accordingly. Overlay and configuration files specific to
this board are also renamed, to match the new board name.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-04-06 13:09:07 +02:00
Carles Cufi 6656214af2 boards: nrf52_pca10040: Rename to nrf52dk_nrf52832
The board name for the nRF52 DK, so far known as nrf52_pca10040, is
renamed to nrf52dk_nrf52832.  Its documentation and all references
to its name in the tree are updated accordingly. Overlay and
configuration files specific to this board are also renamed, to
match the new board name.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-04-06 13:09:07 +02:00
Vinayak Kariappa Chettimada 4547bfb452 Bluetooth: controller: split: handle latency for cancelled conn events
Update implementation of master and slave LLL's to correctly
handle event counter values when latencies introduced due to
connection events cancelled by active events operating in
unreserved time space.

When an active radio event extends into unreserved time
space, and a connection event prepare is scheduled but at
the time of pre-emption timeout if the connection event is
cancelled then the event count and latencies needs to be
continiued to get acummulated.

In the current controller usecases the above scenarios does
not get exercised, the changes in this commit is needed for
future roles that can extend into unreserved time space and
would cancel a scheduled connection event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-04-03 22:10:40 +02:00
Joakim Andersson 93f644e1c0 Bluetooth: Use zd print conversion modifier for ssize_t
Use the zd print conversion modifier for ssizet_t variables.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-03 21:13:14 +03:00
Joakim Andersson f8017adf5c Bluetooth: Use ssize_t for the return value of read_cb
Most places used an int so that should have handled most cases but
keys_set was using an unsigned int, which meant that checking len > 0
is an expression that is always false, and the error handling is not
working.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-02 19:39:28 +03:00
Vinayak Kariappa Chettimada b7e35ae4a3 Bluetooth: controller: legacy: Fix slave latency during conn update
Fix regression in cancelling slave latency during Connection
Update Procedure.

Slave latency should not be applied between the ack of a
Connection Update Indication PDU and until the instant.
When caching was introduced, implementation missed this
consideration.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-04-01 14:41:00 +02:00
Vinayak Kariappa Chettimada bc357718a7 Bluetooth: controller: split: Fix slave latency during conn update
Fix regression in cancelling slave latency during Connection
Update Procedure.

Slave latency should not be applied between the ack of a
Connection Update Indication PDU and until the instant.
When caching was introduced, implementation missed this
consideration.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-04-01 14:40:16 +02:00
Vinayak Kariappa Chettimada 79942b47cc Bluetooth: controller: legacy: Fix DLE duplicate requests
Fix implementation to handle back-to-back and duplicate
LENGTH_REQ PDU reception.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-04-01 14:40:00 +02:00
Vinayak Kariappa Chettimada 9bd4a786cd Bluetooth: controller: legacy: Simplify DLE state checks
Simplify the Data Length Update Procedure state check when
processing incoming LENGTH_REQ/RSP PDUs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-04-01 14:40:00 +02:00
Vinayak Kariappa Chettimada 45500f3dc9 Bluetooth: controller: split: Fix DLE duplicate requests
Fix implementation to handle back-to-back and duplicate
LENGTH_REQ PDU reception.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-04-01 14:39:31 +02:00
Vinayak Kariappa Chettimada d13c6b2b29 Bluetooth: controller: split: Simplify DLE state checks
Simplify the Data Length Update Procedure state check when
processing incoming LENGTH_REQ/RSP PDUs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-04-01 14:39:31 +02:00
Vinayak Kariappa Chettimada e217ade79e Bluetooth: controller: legacy: Validate chan map and hop value
Add validation of channel map and hop increment value
received in CONNECT_IND PDU.

Zero bit count leads to controller assert or divide-by-zero
fault.

Hop increment shall be between 5 and 16 by BT Specification.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-04-01 14:39:17 +02:00
Vinayak Kariappa Chettimada 4a5f263e5a Bluetooth: controller: split: Validate chan map and hop value
Add validation of channel map and hop increment value
received in CONNECT_IND PDU.

Zero bit count leads to controller assert or divide-by-zero
fault.

Hop increment shall be between 5 and 16 by BT Specification.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-04-01 14:38:27 +02:00
Oleg Zhurakivskyy b1e1f64d14 global: Replace BUILD_ASSERT_MSG() with BUILD_ASSERT()
Replace all occurences of BUILD_ASSERT_MSG() with BUILD_ASSERT()
as a result of merging BUILD_ASSERT() and BUILD_ASSERT_MSG().

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-31 07:18:06 +02:00
Kumar Gala 3a59f87ba9 bluetooth: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 16:53:21 -05:00
Andrzej Głąbek 4253eae005 boards: nrf52840_pca10056: Rename board to nrf52840dk_nrf52840
The nRF52840 DK board target, so far known as nrf52840_pca10056,
is renamed to nrf52840dk_nrf52840.
Its documentation and all references to its name in the tree are
updated accordingly. Overlay and configuration files specific to
this board are also renamed, to match the new board name.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-03-27 09:14:08 +01:00
Vinayak Kariappa Chettimada 915c510a0a Bluetooth: controller: split: Remove use of k_cpu_idle
Remove use of k_cpu_idle in controller, and refactor the
implementation used to start, wait and stop clocks needed
by the controller.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-03-24 13:38:59 +01:00
Ioannis Glaropoulos f3807f19dc boards: arm: nrf51_pca10028: rename board to nrf51dk_nrf51422
We rename the nRF51 Dev Kit board target (nrf51_pca10028)
to nrf51dk_nrf51422. We update all associated references
in the supportive documentation and all nRF51-related
cofigurations and overlay files in the samples and tests
in the tree.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-03-24 11:45:27 +01:00
Joakim Andersson e4538c6807 Bluetooth: HCI: Re-organize vendor read static address handling
Add header definition for bt_read_static_addr function. Declaring it
without a header definition will not give any compilation error when
function definition changes.
Refactor nRF SoC specific code into nRF specific source files and
provide weak definitions when these are not implemented. This will make
it easier to add handlers per vendor.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-22 11:58:17 +02:00
Carles Cufi 4b37a8f3a4 Revert "global: Replace BUILD_ASSERT_MSG() with BUILD_ASSERT()"
This reverts commit 8739517107.

Pull Request #23437 was merged by mistake with an invalid manifest.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-03-19 18:45:13 +01:00
Oleg Zhurakivskyy 8739517107 global: Replace BUILD_ASSERT_MSG() with BUILD_ASSERT()
Replace all occurences of BUILD_ASSERT_MSG() with BUILD_ASSERT()
as a result of merging BUILD_ASSERT() and BUILD_ASSERT_MSG().

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-19 15:47:53 +01:00
Andries Kruithof 30e3205e32 Bluetooth: controller: split: correct timing calculation in PKT_US
A bug in the PKT_US resulted in wrong calculations for the 2M phy.
Fixes the bug, verified on EBQ.
Also adds some defines for improved readability.

Fixes #23482

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2020-03-18 16:09:33 +01:00
Vinayak Kariappa Chettimada b7220cef86 Bluetooth: controller: split: Fix densely scheduled event preemption
Fix LLL implementation handling preemption of currently
active radio event with densely scheduled events in the
pipeline.

Preempt timeout was stopped without consideration to there
being more queued events in the pipeline. Also, added
chaining of preemption timeouts one after the other expiry
so as to preempt currently active events by the densely
scheduled events in the pipeline.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-03-18 10:45:43 +01:00
Vinayak Kariappa Chettimada 5474dbb544 Bluetooth: controller: split: Fix regression in handling invalid pkt seq
Fix regression in handling invalid packet sequence in the
first packet in a connection.

This relates to commit 62c1e1a52b ("Bluetooth: controller:
split: Fix assert on invalid packet sequence")

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-03-18 10:44:47 +01:00
Vinayak Kariappa Chettimada 6a37dc5a68 Bluetooth: controller: legacy: Fix regression handling tx pool corruption
Fix regression in handling tx pool corruption in relation to
commit 7a3e29af06 ("Bluetooth: controller: legacy: Fix Tx
pool corruption").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-03-18 10:44:21 +01:00
Wolfgang Puffitsch f3de1f5b38 Bluetooth: controller: split: Fix response to unexpected LL_FEATURE_RSP
Fix response to unexpected LL_FEATURE_RSP for the case that
BT_CTLR_SLAVE_FEAT_REQ is disabled. Fixes LL/PAC/SLA/BV-01 for such a
configuration.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2020-03-17 12:37:03 +01:00
Joakim Andersson 8514794ed3 Bluetooth: controller: Do not use LL procedures not supported by remote
Update LLCP handling during PHY update and Data Length update to not
start the LL control procedure if the remote has already indicated that
the procedure is not supported.

This fulfills the following requirement from the BT Core Specification
(Core_v5.2, Vol 6, Part B, Section 4.6):

Except where explicitly stated elsewhere in this specification, if the
peer Link Layer has indicated either during a feature exchange procedure
or by responding with an LL_UNKNOWN_RSP PDU that it does not support a
procedure, then the Link Layer shall not use that procedure.

Re-use the connection parameter request handling for PHY and
data length update procedures.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-13 13:02:13 +01:00
Vinayak Kariappa Chettimada 8a294a62d4 Bluetooth: controller: legacy: Fix missing first conn event
Fix missing first connection event due to first connection
event ticks_slot overlapping with the initiator window
ticks_slot.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-03-13 10:39:39 +01:00
George Stefan 76b1f03345 bluetooth: controller: openisa/RV32M1: use DSM from LLL
Added the functions to turn on/off the radio from LLL.
Added WAKE_IRQ to start radio after it's out of DSM.

Signed-off-by: George Stefan <george.stefan@nxp.com>
2020-03-12 17:05:02 +02:00
Ionut Ursescu 27878377b2 bluetooth: controller: openisa/RV32M1: introducing radio Deep Sleep Mode
Added the functions to turn on/off the radio.
Deep Sleep Mode (DSM)

Signed-off-by: Ionut Ursescu <ionut.ursescu@nxp.com>
Signed-off-by: George Stefan <george.stefan@nxp.com>
2020-03-12 17:05:02 +02:00
Alex Porosanu cb0a6c2eff bluetooth: controller: openisa/RV32M1: add 2 Mbps PHY support
The radio on the VEGA platform supports both 1Mbps, as well
as 2Mbps BLE PHYs. It does not support coded BLE PHY. This patch
adds the necessary callback, as well as timings to enable the 2 Mbps
PHY support in the SW LL HAL for VEGA.

Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
2020-03-12 13:10:04 +02:00
Vinayak Kariappa Chettimada b466d5399c Bluetooth: controller: legacy: Fix mandatory min PDU len Code PHY
Fix to return the max tx/rx time back to set default time
after using mandatory minimum PDU length and time while
switching back from Coded PHY to 1M PHY.

Also fixes #23109.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-03-10 14:55:31 +02:00
Vinayak Kariappa Chettimada baeed73684 Bluetooth: controller: legacy: Fix DLE tx rx time on PHY update
Fix Data Length Update transmit and receive time calculation
on PHY update procedure completion.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-03-10 14:55:31 +02:00
Vinayak Kariappa Chettimada 5386095ba4 Bluetooth: controller: legacy: Fix Data Length Tx Rx time
Fix Data Length Update procedure calculation of transmit
and receive time.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-03-10 14:55:31 +02:00
Vinayak Kariappa Chettimada 4bacb0e098 Bluetooth: controller: legacy: Fix cond. compile error
Fix conditional compilation error when enabling
BT_CTLR_FAST_ENC for central only application builds.

Also added additional compilation to code exclusive to
central or peripheral role.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-02-29 19:39:41 +02:00
Vinayak Kariappa Chettimada e1d9620187 Bluetooth: controller: legacy: Fix assert on DLE procedure stall
Fix local initiated Data Length Update procedure from being
stalled when a remote initiates a procedure with instant.

Fixes #23069.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-02-28 10:02:15 +02:00
Andries Kruithof 2c70df32b7 Bluetooth: controller: split: Fix regression errors
This commit fixes problems with LL tests CON/SLA/129, CON/SLA/130,
CON/SLA/132, CON/MAS/126, CON/MAS/127, CON/MAS/129, CON/MAS/55,
CON/SLA/57

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2020-02-27 19:14:32 +02:00
Vinayak Kariappa Chettimada 7a3e29af06 Bluetooth: controller: legacy: Fix Tx pool corruption
Fix Tx pool from being corrupted when rough central device
uses invalid packet sequence numbers, causing NULL pointer
to be released into free data Tx pool.

Fixes #22968.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-02-27 12:54:35 +02:00
Dag Bjarvin 1a43a798e7 Bluetooth: controller: Merge 2 lines
Merge 2 lines that fit on one line

Signed-off-by: Dag Bjarvin <Dag.Bjarvin@nordicsemi.no>
2020-02-27 12:30:44 +02:00
Morten Priess 41481f92f7 Bluetooth: controller: Prevent LLCP handling of must-expire events
When a must-expire ticker callback is executed, it is important not to
call the LLCP state machine, as the lazy state is unavailable. The code
must rely on the next proper event to call ull_conn_llcp with an updated
non-zero lazy count.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2020-02-26 09:20:58 +01:00
Andries Kruithof 0ac4433a12 Bluetooth: controller: split: fix LL/CON/MAS/BV-74-C tx timing
Fix EBQ tests for the Max Tx Time and Max Rx Time parameter.

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>

Bluetooth: controller: split: fixed for endianness

Added conversion to correct endianness

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2020-02-25 16:13:17 +01:00
Vinayak Kariappa Chettimada e0f51b29ef Bluetooth: controller: split: Fix assert on DLE procedure stall
Fix local initiated Data Length Update procedure from being
stalled when a remote initiates a procedure with instant.

Fixes #23069.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-02-25 15:14:31 +01:00
Vinayak Kariappa Chettimada ae9bf5e440 Bluetooth: controller: split: Fix radio in use during flash op
Fix a race condition in radio abort requested by flash
driver. It is possible that during abort function execution,
PPI setup to start radio fires. Hence, check explicitly in
cleanup function for radio being in use and disable it.

Fixes #22945.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-02-21 11:38:37 +01:00
Vinayak Kariappa Chettimada 62c1e1a52b Bluetooth: controller: split: Fix assert on invalid packet sequence
Fix to remove assertion failure check on detecting invalid
packet sequence used by peer central and that no non-empty
packet was transmitted.

Fixes #22967.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-02-20 19:34:17 +02:00
George Stefan f8293807da bluetooth: controller: openisa/RV32M1: fix LL scheduling
- avoid spourious radio interrupts by fixing ISR set,
    waiting for idle, command configuration
- adjust counter to account for missing increment
- change preemption instant to avoid missing the deadline in LLL
- decrese EVENT_JITTER_US and
    EVENT_TICKER_RES_MARGIN_US (same as Nordic)

Continuous scanning and connections are working fine now.

Signed-off-by: George Stefan <george.stefan@nxp.com>
2020-02-18 13:48:12 +02:00
Cristi Caciuloiu 2a2f84256c bluetooth: controller: openisa: encryption and decryption using CAUv3
Created unit tests for the encryption and decryption functions.
Tested with the peripheral and with central_hr samples.
Due to latency of CAUv3 when used as CCM inline accelerator
only one of the PDU can be encrypted/decrypted within an
bilateral exchange M->S + S->M in a connection event.
If the RXed PDU is encrypted, the TXed PDU must be empty
with More Data if there is data in the LLL queue.
The TXed PDU will be encrypted when an empty PDU is RXed.

Signed-off-by: Cristi Caciuloiu <cristian.caciuloiu@nxp.com>
2020-02-18 12:34:27 +02:00
Vinayak Kariappa Chettimada 23c5003d12 Bluetooth: controller: split: Fix regression in privacy port
Fix regression due to addition of conditional compilations
while porting the privacy feature from legacy to split
controller.

Fixes #22801.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-02-14 18:21:16 +01:00
Vinayak Kariappa Chettimada 8a3a4bb589 Bluetooth: controller: split: Fix PHY update tx pause
Data transmission was paused when PHY update request control
PDU was enqueued in ULL. If there was pending data PDU in
ULL that was not enqueued towards LLL, this caused
transmission to stall.

Move the tx pause due to PHY update request/response being
enqueued to pre_tx_ack callback, this way all pending PDUs
in ULL is enqueued to LLL.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-02-10 10:22:42 +01:00
Alex Porosanu 03892c1571 Bluetooth: controller: split: openisa: fix missing include
If CONFIG_BT_CTLR_CONN_RSSI is enabled, then lll_conn.h should
be included as well. Otherwise, struct lll_conn is unknown
at the compile unit level. This has been reproduced by
compiling the hci_uart sample, where the following error occurs:

lll_adv.c: In function 'isr_rx_pdu':
lll_adv.c:722:13: error: dereferencing pointer to incomplete
                         type 'struct lll_conn'
    lll->conn->rssi_latest =  radio_rssi_get();
             ^~

Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
2020-02-07 15:52:26 -06:00
Vinayak Kariappa Chettimada a81fc17bb2 Bluetooth: controller: split: Fix uninitialized advertiser rl_idx
Fix uninitialized advertiser rl_idx used to check own identity
in CONNECT_IND received for directed advertisements.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-02-07 14:09:05 +01:00
Peter Bigot ddc3f0699f gpio: replace gpio pin write/read with set/get
This API will be deprecated in favor of the new API that clearly
specifies whether it works on logical or physical levels.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Morten Priess c1cb5ea540 Bluetooth: controller: Remove compiler specific warning
Some compilers can't resolve the conditional if/else/else construction
in ull_conn event_len_prep function, and fail with an 'uninitialized
variables' error. The change has no functional impact.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2020-02-04 18:11:18 +01:00
Joakim Andersson 291ebdd4e4 Bluetooth: Fix infinite recursion in host-based bt_rand
Fix infinite recursion in host-based bt_rand function. This would call
HCI LE Random Number command, which would in turn call bt_rand, causing
an infinite recursion.

bt_rand -> prng_reseed -> BT_HCI_OP_LE_RAND -> le_rand -> bt_rand

To solve this issue the controller should avoid doing calls into the
host, so all calls to bt_rand in the controller should be replaced with
a call to a controller function.

Fixes #22202

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-01-31 18:33:06 +01:00
Morten Priess 2945143edd Bluetooth: controller: split: Force central cleanup on MIC error
Since a peer MIC failure closes the event, it does not allow a terminate
acknowledge. For that reason a peer MIC fail for central role must force
a conn_cleanup.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2020-01-31 10:15:19 +01:00
Andries Kruithof 3db3ae5aed Bluetooth: controller: split: Fix DLE preparation routine
This fixes the EBQ tests 129 and 130. These tests check behaviour for
the DLE procedure when Encoded PHY or 2M PHY are not supported.
See also BT core spec. Version 5.1, Vol6, Part B, Section 5.1.9

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2020-01-30 15:25:40 +01:00
Erik Brockhoff 88f8880e16 bluetooth: controller: fixing issue with white list clear
When clearing the whitelist, possible white listings in resolve list
were left. These are now also cleared.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2020-01-30 15:11:45 +01:00
Vinayak Kariappa Chettimada 0ee81aab9a Bluetooth: controller: Clean up nrf cmake include
Clean up the nRF cmake include file to remove redundant
check for BT_LLL_VENDOR_NORDIC inside the file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-29 15:27:24 +01:00
Wolfgang Puffitsch 2071c2fb7a Bluetooth: controller: Support SMI TX flag as setting
SMI TX is different than other controller features in that it does not
necessarily imply any software changes; whether SMI TX is supported
may be simply a matter of hardware calibration. This change supports
using the same software on chips that do or do not support SMI TX
depending on calibration.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2020-01-28 20:28:50 +01:00
Morten Priess c20a870b6b bluetooth: controller: Added use of slot_window for ADV
Request ticker re-scheduling of ADV (within the 10ms randomized window).

Signed-off-by: Morten Priess <mtpr@oticon.com>
2020-01-28 08:07:54 +01:00
Morten Priess 64c89d682f bluetooth: controller: Implemented dynamic re-scheduling in ticker
As a part of a ticker extension interface, it is now possible to specify
a slot_window when starting a ticker. When setting the
ticks_slot_window to a non-zero value, it is requested that the node
timeout is re-located to a position within the window, where the node
does not collide with other nodes - aligning to the end of the window.
The solution takes into consideration if a node has already been
updated with drift correction (e.g. ADV randomization), subtracting this
from the window.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2020-01-28 08:07:54 +01:00
Vinayak Kariappa Chettimada c793c0edda Bluetooth: controller: split: Update lll_conn_flush interface
Updated the lll_conn_flush interface to pass the connection
handle while the LLL connection context stored handle has
been invalidated.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-27 13:51:08 +01:00
Vinayak Kariappa Chettimada d9c67ebd77 Bluetooth: controller: split: Revert Move invalidation of connection handle
This reverts commit d3e3f8d2b4.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-27 13:51:08 +01:00
Vinayak Kariappa Chettimada 43d8166045 Bluetooth: controller: split: Revert conn handle invalidation
This reverts commit 7417e6e09e.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-27 13:51:08 +01:00
Alex Porosanu 3412612085 bluetooth: controller: refactor CMake related files
Zephyr aims to enable supporting of multiple SW defined
BLE LL. There is a complex hierarchy of defines in the
CMake files controlling the compilation units that part of
the final library. Adding another SW LL implementation
from a different SoC provider will make the main controller
CMake file unmaintable.
As such, split the into vendor-specific CMake files for
easier additions.

Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
2020-01-23 16:08:00 +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
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 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
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
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 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
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
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
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