Commit graph

9523 commits

Author SHA1 Message Date
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
Valerio Setti
aaf463ca7b Bluetooth: make MBEDTLS_AES_ROM_TABLES implied not selected
MBEDTLS_AES_ROM_TABLES let Mbed TLS use precomputed AES tables instead
of generating them at runtime and placing in RAM. It clearly helps
reducing the RAM footprint, but at the same time it increases the ROM
one. In order to let the final user decide which kind of optimization
they prefer, we change the "select" statement with "imply".

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-01-15 22:57:20 +01:00
Pavel Vasilyev
6463d15a66 bluetooth: mesh: Remove assertion for Received List message PDU size
According to MshDFUv1.0, section 6.2.3.5, the Firmware Distribution
Receivers List message is not limited by the size of the receivers list:

```
The number of selected entries shall be limited by the following:
- The number of entries shall not exceed the value of the Entries Limit
  field from the Firmware Distribution Receivers Get message.
- The number of entries shall not cause the message payload to exceed
  the maximum Access PDU size.
```

Thus, this assertion is incorrect as it doesn't allow to have the
receivers list bigger than number of maximal Access PDU size.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-01-15 22:57:01 +01:00
Emil Gydesen
eff93d268a Bluetooth: BAP: Add common capability check
Instead of having 2 separate and non-equal checks for
capabilities in ASCS and the Broadcast Sink, there is now
a single function in pacs.c that performs the
check.

This reduces code size and makes it easier to maintain.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-01-15 19:04:31 +01:00
Emil Gydesen
ba5971e703 Bluetooth: ISO: Move contents of Kconfig.iso to common Kconfig
Move the contents of Kconfig.iso to the common Kconfig
file.

The main reason for this is that the Kconfig.iso filename
has caused issues for some, due to the .iso filename extension.

The contents have been moved to right after the Kconfig options
for BT_CONN which are quite similar.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-01-15 01:39:35 +01:00
Vinayak Kariappa Chettimada
363c1431dd Bluetooth: controller: Fixup Broadcast ISO pre-transmission groups > 1
Fixup payload_index to be uint16_t to avoid index overflow.

Do not remember why ptc is 4 bits, where as it must be 5 bit
value similar to nse; added an assertion check until it is
fixed.

Fix ISO Broadcaster and ISO Sync Receiver for PTO > 1 and
use of Pre-Transmission Group Counts.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-14 15:37:53 +01:00
Vinayak Kariappa Chettimada
9cd9f4150d Bluetooth: Controller: Add back the use of pre-transmissions
Add back the implementation in the Controller that tries to
enable pre-transmissions to improve time diversity to aid a
remote ISO Sync Receiver role device.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-14 15:37:53 +01:00
Morten Priess
d58724d7d7 Bluetooth: controller: Fix ISO broadcaster pre-transmission groups > 1
For pre-transmission groups > 1, the broadcaster link layer would fetch
incorrect payloads from the TX node queue.

Update payload index calculation to reference correct TX payload. Fix
PTO FIXMEs and range checks.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2025-01-14 15:37:53 +01:00
Marcin Szymczyk
94589b784b modules: hal_nordic: nrfx: cleanup
* Move all KConfig configuration from CMake to `nrfx_kconfig.h`
* Move macro utils from `nrfx_kconfig.h` to `nrfx_zephyr_utils.h`
* Move GRTC channels allocation from `nrfx_kconfig.h` to
  `nrfx_reserved_resources.h`

Signed-off-by: Marcin Szymczyk <marcin.szymczyk@nordicsemi.no>
2025-01-14 13:38:03 +01:00
Aleksandr Khromykh
967b096ad9 Bluetooth: Mesh: use secure storage in ble mesh
Commit:
 - adds dependency of the mbedtls psa usage on secure storage
 - removes PSA ITS emulator and enables usage of
   the secure storage in ble mesh bsim tests
 - enables secure storage in all ble mesh and related samples

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-01-14 13:23:47 +01:00
Pisit Sawangvonganan
bd9249457a bluetooth: shell: completely eliminate the dependency on ctx_shell
This commit removes the `ctx_shell` declaration from the Bluetooth shell,
marking a milestone in eliminating this dependency.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-01-14 10:56:16 +01:00
Pisit Sawangvonganan
2ea23cec7c bluetooth: classic: shell: eliminate ctx_shell usage
This change aims to eliminate the dependency on `ctx_shell` in
the Bluetooth `classic/shell/*`, making the code more maintainable.
Replaced `shell_*` functions that depended on `ctx_shell` with
the appropriate `bt_shell_*` functions.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-01-14 10:56:16 +01:00
Pisit Sawangvonganan
f70359bc7c bluetooth: mesh: shell: eliminate ctx_shell usage
This change aims to eliminate the dependency on `ctx_shell` in
the Bluetooth `mesh/shell/*`, making the code more maintainable.
Replaced `shell_*` functions that depended on `ctx_shell` with
the appropriate `bt_shell_*` functions.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-01-14 10:56:16 +01:00
Pisit Sawangvonganan
f1516c960a bluetooth: audio: shell: eliminate ctx_shell usage
This change aims to eliminate the dependency on `ctx_shell` in
the Bluetooth `audio/shell/*`, making the code more maintainable.
Replaced `shell_*` functions that depended on `ctx_shell` with
the appropriate `bt_shell_*` functions.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-01-14 10:56:16 +01:00
Pisit Sawangvonganan
eeda631ee5 bluetooth: shell: move bt_shell_private.c to common folder
Relocated `bt_shell_private.c` to the `common` folder to enable
independent use between `BT_SHELL` and `BT_MESH_SHELL`.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-01-14 10:56:16 +01:00