Commit graph

2090 commits

Author SHA1 Message Date
Nazar Palamar 36fb0279d2 test: bluetooth/tester: fix ccc_find_by_attr
Added check if ccc_values[i].attr != NULL,
before accessing to ccc_values[i].attr structure:
(handle == ccc_values[i].attr->handle)

On 20829 platform it's causing hard fault, not sure about
another platforms (in GAP testing).

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-06-15 04:43:31 -04:00
Nazar Palamar 492439af79 test: bluetooth/tester: add overlays for cyw920829m2evk_02 board
- added overlays for cyw920829m2evk_02 board

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-06-15 04:43:31 -04:00
Rubin Gerritsen bfba19dc41 Bluetooth: Host: Add the API bt_hci_err_to_str()
This API converts a HCI error code to a string.
This can be useful if application developers want to print them
in the applications.

Later we can also use them in the host to improve debuggability.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-06-14 19:17:48 +02:00
Valerio Setti 32b43564df bt: hci_ecc: add option to use PSA APIs instead of TinyCrypt
This commit adds CONFIG_BT_USE_PSA_API to allow the end
user to prefer PSA APIs over TinyCrypt for crypto operations
in bluetooth. Of course, this is possible only if
a PSA provider is available on the system, i.e.
CONFIG_PSA_CRYPTO_CLIENT is set.

This commit also extends
tests/bluetooth/mesh/basic/bluetooth.mesh.gatt adding a specific
case using PSA.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-06-14 15:41:34 +02:00
Valerio Setti 32b792b21f bluetooth: remove BT_TINYCRYPT_ECC in bluetooth mesh tests
Some bluetooth test were using BT_TINYCRYPT_ECC without also
setting BT_ECC. This means that BT_TINYCRYPT_ECC gets disabled
as it depends on BT_ECC.
This commit fix this by removing BT_TINYCRYPT_ECC in all test
for bluetooth mesh.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-06-14 15:41:34 +02:00
Valerio Setti 814b2ed457 bt-host: add option to use PSA APIs instead of TinyCrypt
By enabling CONFIG_BT_USE_PSA_API the user can specify to use
PSA APIs instead of TinyCrypt for crypto operations in bluetooth
host module.

This commit also extends tests/bluetooth/gatt in order to
add a PSA test.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-06-14 15:41:34 +02:00
Valerio Setti 9032f8d791 bt-crypto: add option to use PSA APIs instead of TinyCrypt
This commit adds CONFIG_BT_USE_PSA_API to allow the end
user to prefer PSA APIs over TinyCrypt for crypto operations
in bluetooth. Of course, this is possible only if
a PSA provider is available on the system, i.e.
CONFIG_PSA_CRYPTO_CLIENT is set.

This commit also extends tests/bluetooth/bt_crypto adding
a test case for PSA.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-06-14 15:41:34 +02:00
Jens Rehhoff Thomsen ab9fd0b5c9 Bluetooth: BAP: Add bt_bap_base_get_size function
bt_bap_base_get_size function returns the size of the BASE.

Fixes #73847

Signed-off-by: Jens Rehhoff Thomsen <jthm@demant.com>
2024-06-14 15:34:23 +02:00
Andries Kruithof 7902457437 Bluetooth: audio: test: Unittests for broadcast reception start
Implement unit tests for the broadcast reception start procedure,
both with proper and with improper parameters.

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2024-06-13 16:48:58 -04:00
Alberto Escolar Piedras 5d1afa1a3b tests: Bluetooth: bap_broadcast_source: Fix call
bt_audio_codec_cfg_get_chan_allocation() now takes an
extra parameter.
Let's set it to the value which keeps the old behaviour.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-06-13 11:47:14 -04:00
Nithin Ramesh Myliattil df45858d0f Bluetooth: BAP: Broadcast Source: Update stream codec config data
When creating a BAP broadcast source with bt_bap_broadcast_source_create
only the subgroup information is stored in the streams and the remaining
BIS specific information is not stored in the stream->codec_cfg,
which it should.
Fix is to store bis specific information also in stream codec config.
Updated broadcast source BSIM test to verify above usecase.

Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
2024-06-13 08:04:27 -04:00
Emil Gydesen a62ee400dc tests: Bluetooth: CAP: Add initial CAP initiator unit tests
These test only test the basic functionality of
bt_cap_initiator_unicast_discover so far, but will be expanded.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-06-13 05:42:04 -04:00
Emil Gydesen db4d4cfda2 Bluetooth: Audio: Add fallback to cfg_meta_get_pref_context
Added a fallback parameter to
bt_audio_codec_cfg_meta_get_pref_context
as absence of pref context in BAP implicitly means a unspecified
for LC3.

In the case that it is absent BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED
is the returned value.

While the metadata for codec cfg and codec cap are similar,
this only applies for codec cfg as per BAP.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-06-13 05:41:47 -04:00
Emil Gydesen c4b3b72b07 Bluetooth: Audio: Add fallback to max_codec_frames_per_sdu
Added a fallback parameter to
bt_audio_codec_cap_get_max_codec_frames_per_sdu
as absence of max codec frames per SDU in BAP implicitly
means a single frame for LC3.

In the case that it is absent 1 is the returned value.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-06-13 05:41:47 -04:00
Emil Gydesen 579b4f7e37 Bluetooth: Audio: Add fallback to supported_audio_chan_counts
Added a fallback parameter to
bt_audio_codec_cap_get_supported_audio_chan_counts
as absence of channel count in BAP implicitly means a single channel
for Lc3.

In the case that it is absent 1 is the returned value.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-06-13 05:41:47 -04:00
Emil Gydesen a33543f02e tests: Bluetooth: Audio: Fix bad values in codec cap unit tests
Some codec cap unit tests were using codec cfg values.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-06-13 05:41:47 -04:00
Emil Gydesen c6cc034b5c Bluetooth: Audio: Add fallback to get_chan_allocation
Added a fallback parameter to
bt_audio_codec_cfg_get_chan_allocation as absence of
channel allocation in BAP implicitly means Mono.
In the case that it is absent,
BT_AUDIO_LOCATION_MONO_AUDIO is the returned value.

This commit also fixes the implementation of
bt_audio_codec_cfg_get_frame_blocks_per_sdu as it only applies to
LC3 (as per the BAP spec). It also adds additional testing of it

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-06-13 05:41:47 -04:00
Emil Gydesen be307f8ad9 Bluetooth: Audio: Change lang to 3-byte value from uint32_t
The 3-byte value suits the assigned number much better,
and also allows for less memory copies when getting and
setting the values.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-06-12 12:54:16 -04:00
Emil Gydesen f08bc644a1 Bluetooth: Audio: Rename stream_lang to lang
Remove the "stream" part of the value and functions to
better fit with the name in the assigned numbers document.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-06-12 12:54:16 -04:00
Johan Hedberg 0b8e56120c Bluetooth: doc: Update documentation for the new HCI API
Update references to devicetree chosen properties and how devicetree nodes
should be defined in order to enable the new HCI drivers.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2024-06-11 19:42:49 -04:00
Johan Hedberg 1824dcda7c Bluetooth: tests: Convert to new HCI driver API
Convert all Bluetooth tests that define dummy HCI driver instances to use
the new HCI driver API. This requires both a custom DTS binding as well
as an app-specific overlay file.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Johan Hedberg 00d66339fc Bluetooth: drivers: h5: Convert to new HCI driver API
Convert the H:5 HCI driver to use the new HCI driver API.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Troels Nilsson bed717e2a5 Bluetooth: Controller: Refactor of ull_adv_sync_pdu_set_clear()
ull_adv_sync_pdu_set_clear does pretty much everything, causing
it to be very complex and awkward to use. In addition, it only handles
a single PDU, meaning callers have to handle the chain.
It has been replaced with simpler, more complete functions for handling
the relevant operations

Fixed issues include:

- Fragmentation of adv data over HCI is now decoupled from PDU
  fragmentation, fixing HCI/DDI/BI-13-C, LL/DDI/ADV/BV-26-C and
  LL/DDI/ADV/BV-55-C
- Adding BigInfo now preserves the PDU chain
- Enabling periodic advertising with ADI on would sometimes fail
  due to insufficient space in a single PDU to add ADI

Signed-off-by: Troels Nilsson <trnn@demant.com>
2024-06-11 16:38:05 +03:00
Yassine El Aissaoui bb770c5965 samples: tests: bluetooth: Add support for frdm_rw612
Adding bt_tester support.

Adding bt_tester app build
with Twister for frdm_rw612 board

Fix failing tests/samples due to unsufficent MPU ressources
by releasing unnecessary MPU regions.

Twister builds added on peripheral/central ht and
enabled Power manager on those examples to cover
the CI builds with PM enabled.

Signed-off-by: Yassine El Aissaoui <yassine.elaissaoui@nxp.com>
2024-06-10 07:02:06 -07:00
Emil Gydesen 8136f740df tests: Bluetooth: Move audio related BTP files
Move the audio related files to a new subdirectory called
audio.

The purpose of this is to clean up the file structure a bit,
and also allow for better filtering of the files.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-06-07 22:08:59 -05:00
Vinayak Kariappa Chettimada d6f2bc9669 Bluetooth: Controller: Add explicit LLCP error code check
Add unit tests to cover explicit LLCP error code check and
cover the same in the Controller implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-06-07 18:07:48 +01:00
Emil Gydesen 620708b9e0 Bluetooth: Audio: Shell: Add additional test cases for CAP
Add additional test cases for CAP where only a single CAP
role is enabled.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-06-07 13:01:13 +02:00
Frode van der Meeren e414acfabc Bluetooth: Tester: Adjust bap ext adv options
This change removes the BT_LE_PER_ADV_OPT_USE_TX_POWER option for
extended advertisement in BLE Audio PTS tests.

The Broadcaster setup options was hardcoded to include the
BT_LE_PER_ADV_OPT_USE_TX_POWER option. This causes incompabilities
for any controller not support it, and since the option is not
required for the audio tests it should not be used here.

signed-off-by: Frode van der Meeren <frode.vandermeeren@nordicsemi.no>
2024-06-05 23:39:45 +03:00
Yassine El Aissaoui ffa3f168ec samples: tests: Create dedicated test section for rd_rw612_bga
Monolithic build is enabled by default and it
requires the presence of the binary blobs.
CI will fail since it doesn't fetch them
to the environment. To avoid this
monolithic for BT app is disabled.

Signed-off-by: Yassine El Aissaoui <yassine.elaissaoui@nxp.com>
2024-06-04 19:12:45 -04:00
Yong Cong Sin e54b27b967 arch: define struct arch_esf and deprecate z_arch_esf_t
Make `struct arch_esf` compulsory for all architectures by
declaring it in the `arch_interface.h` header.

After this commit, the named struct `z_arch_esf_t` is only used
internally to generate offsets, and is slated to be removed
from the `arch_interface.h` header in the future.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-04 14:02:51 -05:00
Dominik Ermel 8dc1fcec03 tests: Bluetooth: Mesh: Use flash_area_flatten for erase
The flash_area_erase is replaced with flash_area_flatten that
is also able to erase/scramble devices that do not require
explicit call to erase procedure before write.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-06-04 08:00:46 +02:00
Emil Gydesen d2fbeffaa9 Bluetooth: BAP: Unicast client Split start and connect
Removes the CIS connection establishment from bt_bap_stream_start
and move the behavior to a new funciton bt_bap_stream_connect.

This has 2 advantages:
1) The behavior of bt_bap_stream_start is much more clear and more aligned
with the spec's behavior for the receiver start ready opcode.
2) It is possible to connect streams in both the enabling
and the QoS configured state with bt_bap_stream_connect as
per the spec. This allows us to pass additional PTS test cases.

To implement this new behavior, samples and tests have been updated.

The CAP Initiator implementation has also been updated
to accomodate for the change in BAP, but the CAP
initiator implementation should work the same for application, except
that it's now possible to do unicast start on ASEs in any order
(https://github.com/zephyrproject-rtos/zephyr/issues/72138).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-06-03 15:42:33 +02:00
Emil Gydesen 1af717430a Bluetooth: CAP: Do not require CAS unless necessary
Removes the requirement that CAS is found on the remove
device for ad-hoc sets. This makes the CAP API more
versatile as it allows applications to use it with
remote non-CAP devices.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-06-03 03:39:07 -07:00
Håvard Reierstad d4a59a8655 tests: Bluetooth: Mesh: Default to ext adv
Changes twister tests and nrf samples from using legacy adv to ext adv
since this is the default for Mesh. Legacy adv is still tested in bsim.

Removes redundant test configuration testing ext adv.

Removes redundant config for ext_adv in `multi_ext_adv.conf`.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-06-03 03:01:55 -07:00
Emil Gydesen f93b9dee5c Bluetooth: CSIP: Make set_member_by_conn a public function
The function is useful for application to lookup set
members from bt_conn pointers, e.g. when iterating on
connected devices.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-06-03 09:48:48 +02:00
Vinayak Kariappa Chettimada 4b6d3f1e16 Bluetooth: Controller: Fix missing conn update ind PDU validation
Fix missing validation of Connection Update Ind PDU. Ignore
invalid connection update parameters and force a silent
local connection termination.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-05-31 04:39:34 -07:00
Emil Gydesen 6b6107ccd1 Bluetooth: Audio: Rename set_sirk to just sirk
The S in SIRK is for set, so set_sirk was effectively
"set set".

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-05-31 08:05:24 +02:00
Piotr Narajowski 20cb4c31ca bluetooth: tester: refactor CSIP btp command
Refactor CSIP btp commands by removing the 'count' parameter from
set_coordinator_lock and set_coordinator_release functions.
If we want to support lock/release procedure on subset of set members
in the future, 'count' param doesn't indicate a specific set member.
Instead, introduce 'address_count' and 'addr' array params, although their
usage is not yet implemented.

Signed-off-by: Piotr Narajowski <piotr.narajowski@codecoup.pl>
2024-05-29 14:02:33 +02:00
Yong Cong Sin bbe5e1e6eb build: namespace the generated headers with zephyr/
Namespaced the generated headers with `zephyr` to prevent
potential conflict with other headers.

Introduce a temporary Kconfig `LEGACY_GENERATED_INCLUDE_PATH`
that is enabled by default. This allows the developers to
continue the use of the old include paths for the time being
until it is deprecated and eventually removed. The Kconfig will
generate a build-time warning message, similar to the
`CONFIG_TIMER_RANDOM_GENERATOR`.

Updated the includes path of in-tree sources accordingly.

Most of the changes here are scripted, check the PR for more
info.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-28 22:03:55 +02:00
Mark Wang 5a8652b0c2 tests: bluetooth: shell: test a2dp on mimxrt1060_evk + murata 1xk
add the mimxrt1060_evk hci uart overlay file.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2024-05-28 12:56:42 +02:00
Mark Wang c56183529c tests: bluetooth: shell: add a2dp shell test
implement the current a2dp APIs test.
update the document.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2024-05-28 12:56:42 +02:00
Emil Gydesen a66672885d samples: Bluetooth: Audio: Add missing board/conf
Add missing configuration files for the nRF5340DK
and missing configuration values for the unicast
samples w.r.t. buffer sizes and encryption.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-05-28 09:55:30 +02:00
Yassine El Aissaoui 4a755a3157 samples: tests: bluetooth: Add support for rd_rw612_bga
Adding bt_tester support.

Adding bt_tester app build
with Twister for rd_rw612_bga board

Fix failing tests/samples due to unsufficent MPU ressources
by releasing unnecessary MPU regions.

Disable twister build on samples that are not meant to
be supported on this board, so exclude it from the test cases.

Update peripheral/central ht sample.yaml files
to test build for rd_rw612_bga.

Signed-off-by: Axel Le Bourhis <axel.lebourhis@nxp.com>
Signed-off-by: Yassine El Aissaoui <yassine.elaissaoui@nxp.com>
2024-05-25 11:23:04 +03:00
Szymon Janc d3c0dfbf36 tests: Bluetooth: tester: Fix assert in OTS
MCS OTS support doesn't implement OTS checksum and if this is globally
enabled assert is triggered.

[00:00:03.409,484] <dbg> bttester_gap: set_io_cap: io_cap: 0
ASSERTION FAIL [ots_init->cb->obj_cal_checksum]
     @ WEST_TOPDIR/zephyr/subsys/bluetooth/services/ots/ots.c:476
 Callback for object calculate checksum is not set

This should be reverted when Zephyr issue #72471 is fixed.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2024-05-24 12:57:26 +03:00
Vinayak Kariappa Chettimada 32bc8f2221 tests: Bluetooth: init: Build time coverage for Controller optimization
Added build time coverage for added new Controller
optimization related Kconfigs.

New Kconfigs are either covered in samples.yaml or in the
tests/bluetooth/init conf files.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-05-22 13:38:14 -05:00
Emil Gydesen 96c1cfcfb0 tests: Bluetooth: CAP: Add missing CSIP function
The bt_csip_set_coordinator_csis_member_by_conn function
was seemingly missing, causing the CAP unit tests to not build.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-05-21 18:01:38 +02:00
Emil Gydesen f58ac3476f Bluetooth: CAP: Add reference to the set member for CAP discover
Since the CSIP API expects a set member struct for nearly all
functionality, the reference to the full set member (along with
the CAS specific CSIS) should be given to the application.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-05-18 15:51:26 +03:00
Emil Gydesen 73528a326e Bluetooth: Audio: Shell: Remove increased workqueue stack size
The LC3 in the shell is now done in separate threads with their
own stacks.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-05-16 15:51:45 +02:00
Emil Gydesen f573c3eb01 Bluetooth: Audio: Shell: Fix build errors for USB=n
When CONFIG_USB_DEVICE_STACK=n then the sine wave
generator was enabled, which caused build errors.

This commit fixes those errors and also adds the
nRF5340 as a build target for the USB tests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-05-16 15:51:45 +02:00
Emil Gydesen a6a14360a9 Bluetooth: BAP: Remove err from recv_state_removed callback
The callback is only ever called when we received a
notification from the BASS server that the receive state is
removed, which cannot contain an error code.
Thus it does not make sense for the callback to have an
error code.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-05-15 14:57:20 +02:00