Commit graph

9787 commits

Author SHA1 Message Date
Tim Sørensen
ff2605d23e Bluetooth: CTS: Incorrect assert in bt_cts_init()
Fixup for incorrect assert in CTS service
initialization function bt_cts_init().

Signed-off-by: Tim Sørensen <tims@demant.com>
2025-01-29 12:51:30 +01:00
Emil Gydesen
9688c2d43f Bluetooth: CCP: Initial CCP Client implemenation
Added initial CCP client implementation that simply
does discovery of TBS on a remote CCP server.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-01-28 09:46:39 +01:00
Johan Hedberg
8b356fd9fb Bluetooth: Host: Fix overwriting ECC error value
Jump straight to the exit portion of the function in the case that
psa_destroy_key() failed and we set err to a non-zero value. This also
fixes Coverity CID 487701 "Code maintainability issues  (UNUSED_VALUE)".

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-01-28 00:06:06 +01:00
Johan Hedberg
3ae8a9cfe1 Bluetooth: Host: Remove leftover HCI ECC command checks
The code shouldn't be checking for HCI command support anymore, rather in
the case of debug keys we can just start immediately using them.

Fixes commit 09e86f3b69.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-01-27 13:26:40 +01:00
Valerio Setti
222f8d87b5 Bluetooth: Host: add PSA_WANT_xxx_IMPORT/EXPORT to BT_ECC
The BT Host module also uses import/export PSA functions alongside the
generate one, so these PSA_WANT should be added as well.

Previously it happened to work only because Mbed TLS is enabling
IMPORT/EXPORT internally whenever GENERATE/DERIVE is set. However the
same might not be true for all PSA Crypto providers.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-01-27 11:07:07 +01:00
Dominik Ermel
49f5598835 Bluetooth: Mesh: Improve logic for serving devices erase capabilities
The commit fixes issue where flash_area_flatten has been used where
code was only supposed to erase devices by hardware requirement prior
to write, by replacing the call with flash_area_erase and supporting
logic to select proper path.
There have been following Kconfig options added:
 - CONFIG_BT_MESH_BLOB_IO_FLASH_WITHOUT_ERASE
 - CONFIG_BT_MESH_BLOB_IO_FLASH_WITH_ERASE
that are available for user depending on devices in the system and allow
to turn off paths that are not used by BLOB IO; for example if user
never writes to device with erase CONFIG_BT_MESH_BLOB_IO_FLASH_WITH_ERASE
will disable the path.
Both Kconfig options are y by default and enable all paths.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2025-01-23 19:25:27 +01:00
Johan Hedberg
d3c8cb4b79 Bluetooth: Host: Remove prompt from BT_ECC
This option only exposes internal APIs, so there should be no need to allow
applications to set an explicit value. Instead, users of the API should
select it through Kconfig.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-01-23 10:14:46 +01:00
Johan Hedberg
09e86f3b69 Bluetooth: Host: Remove HCI ECC emulation
Remove the HCI command & event emulation layer for ECDH commands and
events. This means that we always do the necessary operations in the host.
The existing BT_ECC Kconfig option stays, but now gets automatically
enabled when necessary (e.g. based on the BT_SMP option), which is why this
commit removes so many explicit assignments in prj.conf files.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-01-23 10:14:46 +01:00
Vinayak Kariappa Chettimada
7573ac521d Bluetooth: Controller: Fix regression in Code PHY S2 Rx to any PHY Tx
Fix regression in Coded PHY S2 reception to any other PHY Tx
in the s/w switch implementation.

Regression in commit 55b7dba8ec ("Bluetooth: Controller:
Refactor sw_switch hal interface use").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-23 05:23:39 +01:00
Aleksandr Khromykh
a8e540c371 Bluetooth: Mesh: remove experimental flag from mbedtls support
Commit removes experimental flag from mbedtls psa
crypto library support.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-01-22 18:32:51 +01:00
Alberto Escolar Piedras
196062580f Bluetooth: Controller: Use cracen entropy driver for 54L devices
Use the new entropy driver for 54L devices and therefore
claim BT_CTLR_ENTROPY_SUPPORT is always supported
(note 54H remains unsuported)

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-01-22 18:32:35 +01:00
Alberto Escolar Piedras
f4cdb0f07e boards nrf54l15bsim: Default to new cracen rng driver
Let's default to this new driver.
And therefore change the conditions in the BT controller kconfig
which were selecting the native_posix fake entropy driver

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-01-22 18:32:35 +01:00
Fredrik Danebjer
21b5f0c4fe Bluetooth: pacs: Add dynamic PACS registration
Added option to set the PACS Characteristics through the bap API,
making PACS configuration runtime available. Source and Sink PAC, as
well as Source/Sink PAC Location is can be set through a register
function in the PACS api.

Signed-off-by: Fredrik Danebjer <frdn@demant.com>
2025-01-22 15:49:50 +01:00
Alberto Escolar Piedras
0c32349722 Bluetooth: Controller: Correct nrf54l15bsim timings
Correct the timings in the radio HAL for the simulated nRF54L15

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-01-22 10:40:17 +01:00
PENNORS Thomas
5165c911c9 Bluetooth: fix old-style warning gcc
fix GCC warning old-style-declaration on bluetooth host/att.c

Signed-off-by: PENNORS Thomas <t.pennors@lacroix.group>
2025-01-22 05:40:36 +01:00
Vinayak Kariappa Chettimada
f3e398d64c Bluetooth: Controller: Fix uninitialized is_aborted in conn done event
Fix uninitialized is_aborted in connection done event.

Relates to commit cadef5a64f ("Bluetooth: Controller:
Introduce BT_CTLR_PERIPHERAL_RESERVE_MAX").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-21 19:30:41 +01:00
Vinayak Kariappa Chettimada
e09d629024 Bluetooth: Controller: Fix reset of drift_skip count
Fix reset of drift_skip count when an anchor point sync was
missed so that drift compensation is applied on the next
successful anchor point sync. This will improve connection
stability for short overlapping radio event intervals.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-21 19:29:45 +01:00
Vinayak Kariappa Chettimada
5dffad061c Bluetooth: Controller: Fix regression in connection update
The connection event at the connection update instant was
skipped due to previous ticker node in use that is being
stopped was registering a relative occupied time that
overlapped with the new ticker node being started for
scheduling the connection with new interval.

Added mock interface for ticker_stop_abs() hence needed by
the Controller unit testing.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-21 15:13:16 +01:00
Emil Gydesen
e4c5bb99b0 Bluetooth: GATT: Change get_handle function of find_by_uuid
bt_gatt_find_by_uuid used bt_gatt_attr_value_handle but that
function only works to get the value handle of a characteristic
declaration, i.e. if the UUID is not BT_UUID_GATT_CHRC then it
would always return handle = 0. This meant that
bt_gatt_find_by_uuid would always use handle = 0 as the starting
handle for non-BT_UUID_GATT_CHRC attributes, instead of the handle
of the provided attr.

This was not an issue for any UUIDs that may only exist once on a
GATT server, which is most UUIDs, but for UUIDs like the
BT_UUID_TBS_* UUIDs that may be multiple instances of, it would
always return the first attribute rather than the one starting
from the provided start attr.

This commit also ensures that we do not overflow the `end_handle`
when adding 2 uint16_t values.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-01-21 11:11:09 +01:00
Joakim Andersson
a238e5c29d Bluetooth: audio: Fix byteorder in csip sef crypto function
Fix byteorder handling in csip sef crypto function.
On big-endian system we also need to convert the k array from
little-endian to big-endian. The Bluetooth protocol is always using
little-endian ordering.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
2025-01-20 16:28:35 +01:00
Sylvio Alves
1f29980fcd drivers: bt: add additional TX power values
Adds additional custom TX power levels available in
Espressif's chips.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-01-19 19:21:52 +01:00
Vinayak Kariappa Chettimada
750250f129 Bluetooth: Controller: BUILD_ASSERT ticker nodes exceed UINT8_MAX
Added BUILD_ASSERT to ensure ticker node count does not
exceed UINT8_MAX.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
4304640347 Bluetooth: Controller: Add NRF_CCM support in nRF54L15 SoC
Add NRF_CCM h/w based encryption support in nRF54L15 SoCs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
031a17c271 Bluetooth: Controller: Align DDPI usage with nRF54L power domains
Align DDPI usage with nRF54L series power domains and
available DDPI configurations.

Use indices below 4 when needing to bridge with GPIO,
use indices below 8 when needing to bridge with MCU domain
like CCM and AAR; and use indices above 7 to bridge with
Peripheral domain.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
439cd0b8bc Bluetooth: Controller: Minor fix defines and conditional compilations
Replace use of HAL_RADIO_RECV_TIMEOUT_CANCEL_PPI with
HAL_TRIGGER_CRYPT_PPI; they have same value but use the
correctly named HAL_TRIGGER_CRYPT_PPI define now.

Fix conditional compile to correctly exclude reference of
NRF_CCM when CONFIG_BT_CTLR_PRIVACY=n.

Fix missing reference to CCM_TASKS_CRYPT_DELAY_BITS when
CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER=y.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
1508aa49a8 Bluetooth: Controller: Single timer use ISO Peripheral nRF54L support
Update ISO Peripheral for single timer use support required
for nRF54L Series SoCs.

As the timer is reset on every radio end, use the
radio_tmr_hcto_configure_abs() function to set the header
complete timeout correctly when using single timer for s/w
switching.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
b6ce1a6ae0 Bluetooth: Controller: Single timer use ISO Central nRF54L support
Update ISO Central for single timer use support required
for nRF54L Series SoCs.

As the timer is reset on every radio end, use the
radio_tmr_hcto_configure_abs() function to set the header
complete timeout correctly when using single timer for s/w
switching.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
980cc216a8 Bluetooth: Controller: Single timer use ISO Receive nRF54L support
Update ISO Sync Receiver for single timer use support
required for nRF54L Series SoCs.

As the timer is reset on every radio end, use the
radio_tmr_hcto_configure_abs() function to set the header
complete timeout correctly when using single timer for s/w
switching.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
ccba18a32f Bluetooth: Controller: Single timer use Periodic Adv Sync nRF54L support
Update Periodic Advertising Sync implementation for single
timer use support required for nRF54L Series SoCs.

As the timer is reset on every radio end, use the
radio_tmr_hcto_configure_abs() function to set the header
complete timeout correctly when using single timer for s/w
switching.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
88a73dd937 Bluetooth: Controller: Single timer use Conn Scheduling nRF54L support
Update advanced non-overlapping Central Connection Creation
scheduling for single timer use support required for nRF54L
Series SoCs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
c4a6651064 Bluetooth: Controller: Single timer use Extended Scanning nRF54L support
Update Extended Scanning for single timer use support
required for nRF54L Series SoCs.

As the timer is reset on every radio end, use the
radio_tmr_hcto_configure_abs() function to set the header
complete timeout correctly when using single timer for s/w
switching.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
373dc0db71 Bluetooth: Controller: Single timer use Extended Advertising nRF54L support
Update Extended Advertising for single timer use support
required for nRF54L Series SoCs.

As the timer is reset on every radio end, add implementation
to accumulate the last_pdu_end_us.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
28f93157fd Revert "Bluetooth: Controller: Fix ext conn create when using single timer"
This reverts commit a7fff7445c.

The next commit will re-add back the fix to primary
advertising channel plus auxiliary advertising channel too.
This will help keep the fix together regarding use of
single timer for software tIFS switching implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
e4b6751bbc Bluetooth: Controller: Restrict ISO Sync Receiver subevent jitter
Restrict the jitter considered in the PDU reception in the
subevents of ISO Sync Receiver.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
06b7503e33 Bluetooth: Controller: Fix nRF5 radio and event timer abstractions
Fix nRF5 radio and event timer abstractions for some that
where hard coded compared to use of the ones defined in the
resources header file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
7e51788dd7 Bluetooth: Controller: Add radio_sim_nrf54l.h file
Add radio_sim_nrf54l.h file, which for now a copy of the
SoC radio_nrf54lx.h file. This is added for having separate
simulation model dependent timing values and specific
implementation details.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
dd95c22f50 Bluetooth: Controller: Fix single timer s/w switch base indices
Fix single timer s/w switch base indices from overlapping
with sample index.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
3bc24622d3 Bluetooth: Controller: Fix single timer s/w switch when using DPPI
Fix single timer s/w switch when using DPPI on nRF53/54L
where the previous compare register index is incorrect when
the base index is a odd numbered DPPI used.

The issue is discovered as failing ISO Receiver sample with
Coded PHY and single timer use, where the compare base is
configured to use the DPPI 3 (instead of 4).

Upstream samples do not use single timer for s/w switch, the
issue is discovered when adding support for nRF54L which has
to use single timer due to the radio only having a single
timer.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Vinayak Kariappa Chettimada
37bf99eee7 Bluetooth: Controller: Fix radio_tmr_start_us for single timer use
This commit addresses two bugs in use of single timer s/w
switch implementation, incorrect aux_offset in subsequent
ADV_EXT_IND and ISO receiver failing to receive second or
greater BIS subevents.

Fix radio_tmr_start_now implementation to consider the
initial latency in starting the event timer in single timer
use mode. This fixes the incorrect aux_offset in ADV_EXT_IND
PDUs.

Fix radio_tmr_start_us implementation for single timer use,
as the timer is reset on every radio end, and hence the
requested start_us has to be adjusted for the accumulated
last_end_pdu_us value. This fixes the BIS subevent
receptions.

Also, fix the maximum radio ISR latency value used in
radio_tmr_start_us to consider the maximum Rx chain delay
and maximum radio ramp up delays. 80 us + ~30 us + ~40 us
should be able to meet the 150 us tIFS duration.

Relates to commit bcd28e0a86 ("Bluetooth: Controller: Fix
sw switch single timer for spurious TXEN/RXEN").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-18 10:03:41 +01:00
Lyle Zhu
40993fe507 Bluetooth: RFCOMM: Add a argument server to bt_rfcomm_server.accept
In current implementation, the `accept` cannot be identified if the
same one `accept` callback is passed by the upper layer.

Similar with `accept` of `bt_l2cap_server.accept`, add a parameter
`server` to the `bt_rfcomm_server.accept` callback.

Add a argument `server` to function bt_hfp_hf_accept() to avoid
building issue for HFP_HF.

Add a argument `server` to function rfcomm_accept() to avoid building
issue for shell/rfcomm.c.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-01-17 13:54:13 +01:00
Lyle Zhu
87b2a3006c Bluetooth: rfcomm: Support dynamic channel allocation
In the function `bt_rfcomm_server_register()`, the channel cannot be
dynamic allocated. And only pre-set channel is supported.

Improve the function `bt_rfcomm_server_register()` to support the
dynamic channel allocation if the passed channel is zero.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-01-17 13:54:00 +01:00
Lyle Zhu
c4090998d3 Bluetooth: RFCOMM: Move BT_RFCOMM_BUF_SIZE to rfcomm.h
The buffer `BT_RFCOMM_BUF_SIZE` is used to define the TX buffer size of
TX pool.

In current implementation, the TX buffer size of RFCOMM cannot be
calculated due to the macro `BT_RFCOMM_BUF_SIZE` is defined in internal
header file `rfcomm_internal.h`.

Move the macro `BT_RFCOMM_BUF_SIZE` form internal header file
`rfcomm_internal.h` to interface `rfcomm.h`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-01-17 10:41:49 +01:00
Lars Knudsen
bc4a2f37f3 Bluetooth: BAP: Remove ISO limitation on BASE parsing
BASE is now parsed on-the-fly on sink sync, removing
unnecessary restriction in intermediate parsed storage
and without requiring an excessive amount of memory.

Signed-off-by: Lars Knudsen <LAKD@demant.com>
2025-01-17 09:08:16 +01:00
Lingao Meng
6371080406 Bluetooth: Mesh: Fix Assert in bt_mesh_adv_unref when messages to a proxy
Fixes:https://github.com/zephyrproject-rtos/zephyr/issues/83904

This solution fix is to define a separate variable for the each proxy FIFO.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2025-01-17 06:43:08 +01:00
Ahmed Ahmed
6a45e17b4b bluetooth: host: fix connection reference before returning
As the connection was removed from the list, we now own its reference.
Keep this reference and return it to the TX processor.

Signed-off-by: Ahmed Ahmed <ahmed.ahmed@dewinelabs.com>
2025-01-16 22:45:39 +01:00
Ahmed Ahmed
2edddbddb5 bluetooth: host: add asserts to foreach in get_conn_ready
Assert that the previous connection in the list and the tmp element
in the loop are different to the current connection.
Otherwise, if the same connection was somehow added twice it
could result in an infinite loop.

Signed-off-by: Ahmed Ahmed <ahmed.ahmed@dewinelabs.com>
2025-01-16 22:45:39 +01:00
Ahmed Ahmed
099871622a bluetooth: host: iterate over connections in TX list
Iterate over the list of connections to find a connection
that is able to send data, instead of returning NULL if
the first connection can't send data.

This solves the problem with starvation of other connections.

Signed-off-by: Ahmed Ahmed <ahmed.ahmed@dewinelabs.com>
2025-01-16 22:45:39 +01:00
Johan Hedberg
c9647a55fe Bluetooth: Classic: Fix invalid comparison with int8_t
We can't use 0xff to compare with an int8_t since it'll trigger compiler
warnings/errors:

subsys/bluetooth/host/classic/br.c:397:11: error: result of comparison of
constant 255 with expression of type 'int8_t' (aka 'signed char') is
always false [-Werror,-Wtautological-constant-out-of-range-compare]
        if (rssi == 0xff) {
            ~~ ^  ~~
1 error generated.

Use 127 instead for situations where we don't know the RSSI value, like
when processing remote name events. This is fine since from a spec
perspective only -127 - +20 are valid values for the parameter.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-01-16 14:37:44 +01:00
Valerio Setti
11a8a39c63 Bluetooth: Host: imply MBEDTLS_PSA_P256M_DRIVER_ENABLED rather than select
Allow the user to disable the P256-M driver in case their version of
Mbed TLS does not support this driver.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-01-15 22:57:20 +01:00
Valerio Setti
12eee61533 Bluetooth: crypto: add select PSA_WANT_ALG_ECB_NO_PADDING
Explicitly enable "PSA_WANT_ALG_ECB_NO_PADDING" to select the AES ECB
mode that it is used in CMAC operation.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-01-15 22:57:20 +01:00