Commit Graph

1509 Commits

Author SHA1 Message Date
Piotr Pryga ff1d8efd38 Bluetooth: controller: Fix error when max ant. pattern len not defined
Fix compilation error if CONFIG_BT_CTLR_DF is not defined.
If DF was not enabled, there was missing CONFIG_BT_CTLR_DF_MAX_-
ANT_SW_PATTERN_LEN and undeclared symbol was found.

Split ll_df.h into two parts:
- ll_df.h that is generally includeable and allows to successfully
  compile sources when DF is not enabled.
- ll_df_internal.h to be used in soucres that are compiled when
  DF is enabled.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-01-20 14:55:24 +01:00
Piotr Pryga 0b230ae639 Bluetooth: controller: Add DF initialization to controller init sequence
Direction Finding requires initalization of a set of registers
in Radio peripheral. Also it requires information about antenna
matrix unit that are provided by end user in DTS overlay.
Implemented initialization step is responsible for validation of
hardware information delivered by DTS and setting up DF related
registers in Radio.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-01-20 14:55:24 +01:00
Piotr Pryga f3e04898eb Bluetooth: controller: ll_sw: nordic: Add DF antenna configuration handling
Add support for Direction Finding antenna configuration in
Nordic hal of Bluetooth controller.
Add handling of response for HCI_LE_Read_Antenna_Information
HCI command in controller (upper and lower link layer).
Handling of response to the command requires antenna matrix
configuration.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-01-20 14:55:24 +01:00
Andrzej Głąbek dbf9d99e54 bluetooth/controller: Update paths in inclusions of nrfx HAL files
After nrfx glue code was decoupled from nrfx sources, it is no longer
feasible to use those inclusions in the <nrfx/hal/nrf_*.h> form (there
is no point in adding the main directory of the hal_nordic module as
an include path solely for this reason). Remove then the nrfx/ part.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-01-19 17:35:04 +01:00
Nirosharn Amarasinghe b2fcda8efb Bluetooth: Controller: re-factor magic constants
Defined 625 and 1250 as context specific interval common to ULL and LLL.
Checked with bluetooth sanity checks.

Fixes #23314.

Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
2021-01-18 19:12:12 +01:00
Thomas Ebert Hansen 65b453d44e Bluetooth: controller: Fix header inclusion
Use correct headers to make the inclusion of lll.h work when
CONFIG_BT_CTLR_USER_EXT is enabled.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2021-01-18 19:07:06 +01:00
Thomas Ebert Hansen c3f557c12b Bluetooth: controller: User defined CPR intervals
Some proprietary protocols that reuse the Bluetooth LLCP logic requires
that the CPR interval has a valid range that differs from the Bluetooth
specification defined.

Vendor must implement the function (ull_vendor.h)
uint16_t ull_conn_interval_min_get(struct ll_conn *conn)
that returns the valid limit for the given connection.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2021-01-18 19:07:06 +01:00
Morten Priess 3617128cf4 Bluetooth: controller: Add vendor operations to TICKER_USER_LLL_OPS
Allow vendor specific increase of user operation capacity for LLL, to
support queuing additional ticker operations from lower link layer
context. These would typically take place in lll_xxx_prepare.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2021-01-15 11:37:23 -05:00
Vinayak Kariappa Chettimada 21d9bb6e51 Bluetooth: controller: Remove BIT64 redundant definition
Remove the redundant definition of BIT64 macro.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-15 11:21:25 -05:00
Piotr Pryga f36b7a8732 Bluetooth: controller: hci: Add HCI_Set_Connectionless_CTE_TX_Enable cmd
Add implementation of HCI_Set_Connecitonless_CTE_TX_Enable
command to HCI. Add scratch implementation of command handling
functions to controller.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-01-14 15:26:32 +01:00
Piotr Pryga 43a1304e9a Bluetooth: controller: df: Config help corrction correction
Correct names of kconfig entries to mach to style of other entries.
Style correction in hci.c. Use the same approach of checking if
Kconfig entry is enabled.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-01-14 15:26:32 +01:00
chao.an bc7e86b9ec Bluetooth: host: Unified namespace of hci event
BT_HCI_EV_LE_REMOTE_FEAT_COMPLETE ->
BT_HCI_EVT_LE_REMOTE_FEAT_COMPLETE

Signed-off-by: chao an <anchao@xiaomi.com>
2021-01-12 12:30:11 +02:00
Morten Priess 907a8377b3 Bluetooth: controller: Fixed conn_meta bitflag misalignment
Fixed misalignment of bitflag in ll_conn type causing unintentional
overwrite between unions. Common flag must be present in master/slave
uinons as well. Problem is only present when enabling feature
CONFIG_BT_CTLR_CONN_META, which is default disabled.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2021-01-10 15:40:05 -05:00
Vinayak Kariappa Chettimada e0ff2d0957 Bluetooth: controller: Reserve link Rx buffer to ISO sync
Reserve two link rx buffer for each supported Broadcast ISO
sync instance, for establishment and for sync lost node rx
generation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-10 15:39:42 -05:00
Aurora Sletnes Bjørlo 717687806c bluetooth: controller: radio: Add guards on TXPOWER
For tx_power_max_get and tx_power_floor, only allow for
positive values of txpower if they are defined.

Signed-off-by: Aurora Sletnes Bjørlo <aurora.sletnes@nordicsemi.no>
2021-01-10 15:39:22 -05:00
Vinayak Kariappa Chettimada 8a5154d71c Bluetooth: controller: Add missing initialization of ISO sync
Add missing initialization of ISO sync context to be
established.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 18:02:34 +01:00
Vinayak Kariappa Chettimada c709d4f85f Bluetooth: controller: Rename periodic adv rx enable flag
Rename the Periodic Advertising Rx Enable flag from
is_enabled to is_rx_enabled.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 18:01:44 +01:00
Vinayak Kariappa Chettimada 44492c8324 Bluetooth: controller: Rename supported ISO Sets Kconfig
Rename Kconfig BT_CTLR_SCAN_SYNC_ISO_MAX to
BT_CTLR_SCAN_SYNC_ISO_SET, to be consistent with other
Kconfig naming.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 18:01:10 +01:00
Vinayak Kariappa Chettimada 32a79dd7e3 Bluetooth: controller: Fix AUX_CONNECT_RSP PDU buffer size
AUX_CONNECT_RSP PDU static buffer definition was missing one
byte required for the Extended Header Flags.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 18:00:35 +01:00
Vinayak Kariappa Chettimada 5d3d9b7522 Bluetooth: controller: Internal documentation of node rx count
Document with comments, the explanation of node rx count and
the design of the free rx PDU management.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 17:59:59 +01:00
Vinayak Kariappa Chettimada bc71d39d81 Bluetooth: controller: Fix free Rx PDU queue starvation
Fix for scenarios where in active PHY Update Procedure or
Connection Update Procedure could cause temporary depletion
of the free Rx PDUs in the queue between LL/HCI thread
context to LLL context. Symptoms being on-air NACKing during
the above said procedures, causing supervision timeouts due
to procedures not completing at instants.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 17:59:59 +01:00
Vinayak Kariappa Chettimada 2a99857cad Bluetooth: controller: Refactor PA/LNA PPI configuration
Refactor the implementation of PA/LNA PPI configuration
which was done on every Tx or Rx as common code to be
executed once per radio reset. And only setup the timeout
and enabling of PPI at every Tx or Rx.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 17:59:20 +01:00
Vinayak Kariappa Chettimada 5470444e6a Bluetooth: controller: PA/LNA use NRF_P0/P1 define
For PA/LNA implementation use NRF_P0/P1 defines instead of
the deprecated NRF_GPIO to reference GPIO Port 0 registers.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 17:58:24 +01:00
Vinayak Kariappa Chettimada e51295a309 Bluetooth: controller: Fix missing GPIOTE channel disable
Fix the missing GPIOTE channel disable when GPIOTE channel
is alternately used between PA and LNA use.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 17:58:01 +01:00
Vinayak Kariappa Chettimada f265b178c3 Bluetooth: controller: Fix regression in PA/LNA support
Fix regression in PA/LNA support wherein the GPIO pins where
left in undefined state after each radio event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 17:57:29 +01:00
Vinayak Kariappa Chettimada e14be4477a Bluetooth: controller: Fix missing call to radio_setup interface
Fix regression, add back missing call to radio_setup HAL
interface. This is needed to setup the initial PA/LNA GPIO
states.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 17:56:57 +01:00
Vinayak Kariappa Chettimada 108d431902 Bluetooth: controller: nRF52811: Errata Id 164 not applicable
nRF52840 Engineering A Errata Id 164 is not applicable to
nRF52811 SoC.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-07 17:56:03 +01:00
Vinayak Kariappa Chettimada db5270bd93 Bluetooth: controller: nRF53x: SWI mapping should use SOC define
SWI IRQ line mapping for nRF5340 shall use
CONFIG_SOC_NRF5340_CPUNET for conditional compilation
instead of the board define, so as to allow new boards to
use the BLE controller implementation.

Fixes #30488.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-06 16:25:52 +01:00
Vinayak Kariappa Chettimada 0a23b1248f Bluetooth: controller: Remove is_enabled flag for BIS events
Remove is_enabled flag in LLL of BIS events context, as the
status returned from ticker_stop interface is sufficient to
determine if the Broadcast ISO Sync was established or not.
HCI Command Disallow as reason is to be returned if sync was
not established or sync was loss prior to call of HCI LE
BIG Terminate Command was called.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-04 16:27:58 +01:00
Vinayak Kariappa Chettimada 30740b4397 Bluetooth: controller: Move lll_sync_iso.h common to all vendors
Move lll_sync_iso.h as common to all vendors, as currently
there is nothing that is vendor specific.

Fixes #31044.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-04 16:27:58 +01:00
Andrzej Kaczmarek f8c8cac714 Bluetooth: controller: Use PHY_xxx symbols consistently
We have convenient PHY_1M, PHY_2M and PHY_CODED symbols defined but
they are not used too much in the code. This replaces all usages of
magic numbers and other symbols as PHY constants with those symbols.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-12-20 13:04:13 -05:00
Emil Gydesen 47aa17bb5c Bluetooth: controller: Implements ULL Sync ISO ticker
Implements the ull_sync_iso_setup function which starts the
ticker for ISO sync. Furthermore, ll_big_sync_terminate
will not stop the ticker as well.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-12-20 13:36:50 +01:00
Emil Gydesen 9d4d6d06a0 Bluetooth: controller: Implements BIG sync commands in the ULL
Implements handling of the BIG sync commands in the ULL.
LLL support and handling of ACAD (biginfo) remaining.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-12-20 13:36:50 +01:00
Vinayak Kariappa Chettimada e603b9d59e Bluetooth: controller: Adjust PPI used for nRF51x and nRF52x
Adjust the PPI used by nRF51x and nRF52x so that PPI 0-5 is
available for application's use or for SW PWM driver use.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-12-20 13:36:09 +01:00
Morten Priess 467fd155a8 Bluetooth: controller: Make must-expire runtime configurable
Under CONFIG_BT_TICKER_EXT configuration, the ticker interface has been
extended to support enabling/disabling must-expire scheduling. This
means that conn and slave ticker start calls can now omit must-expire
default-on configuration, relying on LLL updating the mode as needed.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2020-12-20 13:35:58 +01:00
Andrzej Kaczmarek 07bb612875 Bluetooth: controller: Call lll_adv_aux initialization funcs
lll_adv_aux_init and lll_adv_aux_reset were not called anywhere.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-12-17 11:36:25 +01:00
Andrzej Kaczmarek 07ebf3d06d Bluetooth: controller: Release resources on failed AUX_CONNECT_RSP
We allocate nodes on receiving AUX_CONNECT_REQ, but we can only use
them if AUX_CONNECT_RSP is sent successfully. If that fails, we need
to release those nodes.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-12-17 11:36:25 +01:00
Andrzej Kaczmarek 3fc74be7e7 Bluetooth: controller: Allow to simply release node allocated in LLL
If we allocate a node in LLL and it turns out that we don't need it
(e.g. allocated connection on AUX_CONNECT_REQ, but connection handshake
did not complete and we don't need it) we still need to send it to ULL
to be released. We can use existing NODE_RX_TYPE_DC_PDU_RELEASE node
type for this purpose, but we just need to make sure it's passed from
LLL to ULL properly.

Also, since this now does not only release DC PDUs, let's change its
name to a more generic one.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-12-17 11:36:25 +01:00
Andrzej Kaczmarek 98d7adc30d Bluetooth: controller: Stop aux after connected
After slave connection is created only adv instance is stopped, we also
need to stop aux separately if enabled.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-12-17 11:36:25 +01:00
Andrzej Kaczmarek 88a8fc1d5e Bluetooth: controller: Make global helper to get aux handle
Just make local function a global one, we need this in other files
as well.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-12-17 11:36:25 +01:00
Andrzej Kaczmarek 01448bf378 Bluetooth: controller: Fix phy initialization when enabling adv
Make sure phy is properly initialized to 1M when ext adv is supported
and legacy advertising instance is being enabled.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-12-17 11:36:25 +01:00
Andrzej Kaczmarek dd102e61c0 Bluetooth: controller: Add support for connectable ext adv
This adds handling for received AUX_CONNECT_REQ PDU which enables slave
connection with extended advertising.

Once AUX_CONNECT_REQ is received, standard checks are performed to
determine if we have resource to create connection, however unlike for
CONNECT_IND an rx node is temporarily kept in LLL until AUX_CONNECT_RSP
is successfully sent. This is to prevent creating a connection in case
response PDU was not sent for whatever reason.

A separate scratch buffer is created for AUX_CONNECT_RSP since default
radio scratch buffer is already used by received AUX_CONNECT_REQ.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-12-17 11:36:25 +01:00
Andrzej Kaczmarek 2709c2c79a Bluetooth: controller: Initialize conn for connectable ext adv
Connection structs need to be initialized when advertising is enabled
on connectable extended advertising instance.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-12-17 11:36:25 +01:00
Andrzej Kaczmarek f5d3a637a4 Bluetooth: controller: Use proper phy when initializing slave conn
Connection created from extended advertising instance uses the same phy
as on secondary channels.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-12-17 11:36:25 +01:00
Andrzej Kaczmarek 384b64508c Bluetooth: controller: Use proper channel sel algorithm
Connections created from extended advertising instance always use CSA2.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-12-17 11:36:25 +01:00
Andrzej Kaczmarek 6c8c97a26e Bluetooth: controller: Use proper transmitWindowDelay for slave
transmitWindowDelay is either 2.5ms or 3.75ms when AUX_CONNECT_REQ is
used (for 1M/2M and Coded respectively). It also uses the same unit
as transmitWindowOffset (1.25ms) so we can just simply add both.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-12-17 11:36:25 +01:00
Andrzej Kaczmarek 68723274da Bluetooth: controller: Use decoded AdvA/TargetA for conn ind helper
The same helper will be used for legacy and extended advertising so we
better pass AdvA and TargetA directly instead of complete advertising
PDU. This is because those fields are at different locations in legacy
and extended advertising PDUs so caller can figure them out.

Also, we can now check for directed advertising using TargetA since it
will be only supplied for such advertising (NULL otherwise).

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-12-17 11:36:25 +01:00
Andrzej Kaczmarek ffb320504c Bluetooth: controller: Add public helper to process connection ind
We will use the same code for auxes so let's make it public.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-12-17 11:36:25 +01:00
Vinayak Kariappa Chettimada a46d090328 Bluetooth: controller: Release blocking LF clock request
Release the LF clock requested in blocking mode used to wait
to settle, which has already been asynchronously requested.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-12-17 11:24:19 +01:00
Vinayak Kariappa Chettimada da18345b08 Bluetooth: controller: nRF5x: Fix lll LF clock wait
Fix lll_clock_wait function to wait for LF clock to settle
only once after power up.

Regression introduced in commit 2b4763076e ("bluetooth:
controller: Adapt to onoff clock control").

Fixes #30480.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-12-17 11:24:19 +01:00