Commit graph

9523 commits

Author SHA1 Message Date
Emil Gydesen
ef6298f98a Bluetooth: ISO: Fix issue with peripheral calling central cleanup code
In bt_iso_chan_disconnected we did not check for role before
we started to get the CIG and setting the CIG state.

Mmove the CIG code to the central part of the if statement.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-12-02 10:53:06 +01:00
Morten Priess
254c33bac2 Bluetooth: controller: Introduction of RXFIFO composite
By use of the new macro RXFIFO_DEFINE, a complete set of data
structures for supporting a MEMQ'able FIFO with data pool backing is
created. This is intended for RX nodes such as done-events, RX PDU-
and ISO PDU events. The purpose is to simplify the data management
and code complexity, and provide re-usability.

This commit implements the existing done structures (MFIFO, mem pool,
mem link pool) as an RXFIFO. ISO is the next customer, and later the
pdu_rx_free MFIFO- and related pools may be refactored.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2021-12-02 10:52:57 +01:00
Krzysztof Chruscinski
5ef63d8313 Bluetooth: Controller: nordic: Rework hw resources files
Move all defines that specifies (D)PPI resources which are used
to dedicated files which have no include dependencies. This allow
to use them in nrfx_glue.h to specify fixed (D)PPI channels used
by the bluetooth.

Additionally, added mask with GPIOTE channels used by the bluetooth
controller. It was previously not defined which could lead to
conflicts since same channels could be allocated by the nrfx_gpiote
user

Updated nrfx_glue.h to use new approach.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-02 09:55:48 +01:00
Lingao Meng
5c796a960b Bluetooth: Mesh: Replace macro as inline
Use inline function ins of macro.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-12-02 09:23:54 +02:00
Lingao Meng
aeb12304b3 Bluetooth: Mesh: Add common section for ext_adv
Use section for omit macro config.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-12-02 09:23:54 +02:00
Lingao Meng
414250106f Bluetooth: Mesh: Introduce tag field
Introduce tag field.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-12-02 09:23:54 +02:00
Lingao Meng
e922f4fc9f Bluetooth: Mesh: Move common gatt adv to adv.c
Since gatt adv send have common logic between adv_ext.c
and adv_legacy.c, so move to adv.c

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-12-02 09:23:54 +02:00
Lingao Meng
24b41622b4 Bluetooth: Mesh: Add macro for bt_mesh_relay_queue
If multi relay advertising feature not used, we can
compiled out for save some memory.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-12-02 09:23:54 +02:00
Lingao Meng
83bc5d0953 Bluetooth: Mesh: Rename gatt adv func
Since this module is already changed, current really
confuses when trying to understand the code.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-12-02 09:23:54 +02:00
Lingao Meng
f0dd85567c Bluetooth: Mesh: add static bt_mesh_adv_create_from_pool
Since this function not use by other place, so add static.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-12-02 09:23:54 +02:00
Lingao Meng
56785c173b Bluetooth: Mesh: Add Multi Advertising Sets Support
This PR add multi advertising sets for bluetooth mesh adv bearer.
At the present, the local mesh network occupy single advertising.
And GATT Services Advertising use a single advertising, if support.

One or more advertising sets maybe used by relay node.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-12-02 09:23:54 +02:00
Lingao Meng
10f902b1d7 Bluetooth: Mesh: Introduce adv tag field when create buf
Introduce tag field when create adv buffer.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-12-02 09:23:54 +02:00
Lingao Meng
1feb72b026 Bluetooth: Mesh: Move unused public api
Move bt_mesh_adv_create_from_pool to source code

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-12-02 09:23:54 +02:00
Jakob Krantz
f20250cc5a Bluetooth: host: Add endian handling of rssi in adv. IQ report.
When populating bt_df_per_adv_sync_iq_samples_report the
rssi was not wrapped in sys_le16_to_cpu.

Signed-off-by: Jakob Krantz <jakob.krantz@u-blox.com>
2021-11-29 18:56:13 -05:00
Jakob Krantz
2f6b9ce406 Bluetooth: host: Expose per adv evt counter in CTE IQ report.
Allows the application to access the periodic advertising counter.

Signed-off-by: Jakob Krantz <jakob.krantz@u-blox.com>
2021-11-29 18:56:13 -05:00
Piotr Pryga
5dd5902f67 Bluetooth: controller: Add missing NULL assign to df_cfg in ll_adv_set
ll_adv_set stores poitner to direction finding TX configuration.
When ll_reset is executed the pointer was not NULL assigned.
That lead to erroneous behavior e.g. df_cfg->is_enabled was set
to TRUE even the functionality was not enabled.
DF configuration is stored in memory pool. The memory pool uses
free elements to store its internal data. On reset whole pool is
expected to be free, so ll_adv_set->df_cfg may not point to any
element allocated from memory pool.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-11-29 18:29:43 -05:00
Szymon Janc
1f54179889 Bluetooth: Controller: Fix build for hci_uart sample with new LLCP
ull_tx_queue.h needs to be included before ll_sw/ull_conn_types.h

zephyr/zephyr/subsys/bluetooth/controller/hci/hci.c
In file included from zephyr/zephyr/subsys/bluetooth/controller/
    hci/hci.c:52:
../../subsys/bluetooth/controller/./ll_sw/ull_conn_types.h:453:18:
     error: field 'tx_q' has incomplete type
  453 |  struct ull_tx_q tx_q;
      |                  ^~~~

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-29 16:27:17 +01:00
Vinayak Kariappa Chettimada
121373167a Bluetooth: Controller: Fix to use ADI flag in Periodic Adv Enable
Fix implementation to use ADI flag in Periodic Advertising
enable command to add ADI field in Periodic Advertising
PDUs.

Related to commit 6433a6aac1 ("Bluetooth: Controller:
Add Periodic Advertising ADI support").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-26 10:26:17 -05:00
Krzysztof Chruscinski
9886bdc0c8 drivers: pwm: pwm_nrf5_sw: Use runtime resources allocation
Use nrfx_gpiote and nrfx_ppi allocators to allocate channels
at runtime instead of fixed, device-tree based allocation which
is harder to maintain.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-11-26 09:31:54 +01:00
Andries Kruithof
984ebd519a Bluetooth: controller: remove obsolete defines
The define for PDU_AC_LL_SIZE_EXTRA was removed in main, but not in
the topic-branch. The merge of topic/branch erroneously reintroduced
this define, so it needs to be removed

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2021-11-25 10:46:08 -05:00
Andries Kruithof
2e2900f1bb Bluetooth: controller: revert erroneous deletion
During work on the new LLCP the assignment to
phy_aux_flags_rx was by accident deleted.
This reverts that deletion

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2021-11-25 10:45:50 -05:00
Ilhan Ates
917adaea77 Bluetooth: host: Fix notify multiple issue
When multiple notify feature is enabled, notifications are pushed
twice. Host sends multiple notify with BT_ATT_OP_NOTIFY_MULT and
then continues to send regular notification with BT_ATT_OP_NOTIFY.

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/40546

Signed-off-by: Ilhan Ates <ilhan.ates@nordicsemi.no>
2021-11-25 10:44:54 -05:00
Vinayak Kariappa Chettimada
2c65856ee8 Bluetooth: Controller: Initial ISO Sync Receiver datapath integration
Initial attempt at integrating the ISOAL datapath with ISO
Synchronized Receiver implementation to generate HCI ISO
data packets.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-25 10:43:51 -05:00
Vinayak Kariappa Chettimada
ff1e3a80cf Bluetooth: Controller: ISO Synchronized Receiver multiple streams
Added implementation to receive multiple Broadcast ISO
streams.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-25 10:43:51 -05:00
Vinayak Kariappa Chettimada
8e33160981 Bluetooth: Controller: Implement ISO Sync Receiver connection handle
Implement ISO Synchronized Receiver connection handle
representing the streams in the BIG Sync. Add implementation
to return these handles on Sync Established event, and to
release these on Sync Lost.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-25 10:43:51 -05:00
Vinayak Kariappa Chettimada
66dc992fc2 Bluetooth: Controller: Implement ISO Broadcaster connection handle
Implement ISO Broadcaster connection handle representing the
streams in the created BIG. Add implementation to return
these handles on BIG complete event, and to release these on
BIG terminate.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-25 10:43:51 -05:00
Vinayak Kariappa Chettimada
45bde629d1 Bluetooth: Controller: Fix Broadcast ISO EVENT_OVERHEAD_START_US jitter
As EVENT_OVERHEAD_START_US offset is used in ticks unit in
LLL, ULL scheduling using ticker should also use ticks unit
for EVENT_OVERHEAD_START_US when reducing the first ISO
Broadcast and Synchronized Receiver event preparation.

Relates to commit 858dc7fab4 ("Bluetooth: controller: Fix
EVENT_OVERHEAD_START_US jitter").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-25 10:43:51 -05:00
Abe Kohandel
a6f932a194 bluetooth: ots: Add Create and Delete procedures
Add the ability to perform an OTS Create or Delete Procedure.

Signed-off-by: Abe Kohandel <abe.kohandel@gmail.com>
2021-11-24 21:49:11 +02:00
Frode van der Meeren
48f90cc2e4 bluetooth: Increase ACL packet size limit for non-Zephyr controllers
Increases the size-limit of ACL packets, to accomodate for using Zephyr
as a host for controllers which support ACL packets larger than 251
bytes.

Signed-off-by: Frode van der Meeren <frode.vandermeeren@nordicsemi.no>
2021-11-24 14:19:07 -05:00
Jordan Yates
df327eeb58 net: buf: POOL_FIXED_DEFINE explicit user data
Update the macro prototype to explicitly require the length of the
desired user data. Update all in-tree usage of this macro.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-11-24 16:04:50 +02:00
Marek Pieta
a08b65ef42 bluetooth: att: Fix indication handling
Zephyr device that is not a GATT Client, should ignore indication.

An Android device may send an indication even if Zephyr
device does not support GATT Client role. In that case, the sent
error response was improperly matched to subsequent GATT request
of the Android device which caused issues.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2021-11-24 13:55:47 +01:00
Vinayak Kariappa Chettimada
0a44f38a10 Bluetooth: Controller: Fix dummy ISO Broadcast PDU for correct LLID
Fix the dummy ISO Broadcast PDU for correct LLID when
testing with burst number, immediate repetition count and
pre-transmission offset.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-23 18:16:23 +01:00
Vinayak Kariappa Chettimada
f44d0667c5 Bluetooth: Controller: Fix link buffer allocation for ISO Broadcaster
Fix missing link buffer allocation for ISO Broadcaster role.
Without this allocation, create BIG will fail.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-23 18:16:16 +01:00
Lingao Meng
476c2f12d3 Bluetooth: Mesh: Add app_key_upd command
Add app_key_upd cmd.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-11-23 13:08:45 +02:00
Lingao Meng
c92eedc037 Bluetooth: Mesh: Add net_key_upd command
Add net_key_upd cmd.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-11-23 13:08:45 +02:00
Lingao Meng
bd44104b38 Bluetooth: Mesh: Add node_id command
Add node_id cmd.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-11-23 13:08:45 +02:00
Lingao Meng
cd2ea62643 Bluetooth: Mesh: Add krp command
Add krp cmd.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-11-23 13:08:45 +02:00
Lingao Meng
ec80168ec0 Bluetooth: Mesh: Add lpn_polltimeout_get command
Add polltimeout_get cmd.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-11-23 13:08:45 +02:00
Lingao Meng
cd9736cbbe Bluetooth: Mesh: Add model_sub_del_all command
Add mod_sub_del_all cmd.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-11-23 13:08:45 +02:00
Lingao Meng
81a1cd45a6 Bluetooth: Mesh: Add mod_sub_ow_va command
Add mod_sub_overwrite_va cmd.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-11-23 13:08:45 +02:00
Lingao Meng
ef04742a08 Bluetooth: Mesh: Add model_sub_ov command
Add mod_sub_overwrite cmd.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-11-23 13:08:45 +02:00
Lingao Meng
7c812c237d Bluetooth: Mesh: Add model publish va set command
Add mod_pub_va cmd.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-11-23 13:08:45 +02:00
Vinayak Kariappa Chettimada
4de9940a75 Bluetooth: Controller: Fix ISO Broadcast conditional compile
Fix ISO Broadcast only supported related conditional compile
so that data path setup does not return command disallowed.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-23 11:39:38 +01:00
Vinayak Kariappa Chettimada
85eac820ca Bluetooth: Controller: Rename ull_adv_iso_get to internal iso_get
Rename internal static function ull_adv_iso_get to iso_get.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-23 11:39:32 +01:00
Vinayak Kariappa Chettimada
4cb88bf024 Bluetooth: Controller: Refactor PTC interation value into function
Refactor implementation calculating the Pre-transmission
subevent iteration count into function.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-23 11:39:32 +01:00
Vinayak Kariappa Chettimada
1a88f1c3cd Bluetooth: Controller: Fix PTC value calculation considering num_bis
Fix PTC iteration value calculation for pre-transmission
subevents to consider multiple BIS events in the BIG event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-23 11:39:32 +01:00
Vinayak Kariappa Chettimada
db76c774e4 Bluetooth: Controller: Fix ad_data population in AUX_SYNC_IND PDU
Use memcpy to access the reference to AD data passed in the
list of length encoded parameters used to construct the
Common Extended Payload Format in AUX_SYNC_IND PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-23 11:39:17 +01:00
Vinayak Kariappa Chettimada
13332deaba Bluetooth: Controller: ISO Sync payload number and timestamp
Add implementation to send ISO Sync payload number and
timestamp from LLL to HCI/ISOAL layer.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-23 11:39:10 +01:00
Vinayak Kariappa Chettimada
e04a19003b Bluetooth: Controller: Move iso_interval field from ULL to LLL context
Move the iso_interval field from ULL to LLL context to
facilitate calculation of timestamp when there is PTO in
the BIG events.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-23 11:39:10 +01:00
Vinayak Kariappa Chettimada
548fcab648 Bluetooth: Controller: Fix initialize of ISO sync ctrl proc variables
Fix missing initialization of ISO sync control procedure
variables.
Without this initialization, after synchronization the sync
is lost.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-11-23 11:38:58 +01:00