Commit graph

9523 commits

Author SHA1 Message Date
Joakim Andersson
ee81c0865d Bluetooth: GATT: Consistent permission handling of discovered attribute
Be consistent in the permission handling of the discovered attribute
in the temporary object given in the discovery callback.
For characteristics the permission field was set to READ, while for
all other attributes it was set to 0.

Fixes: #29083

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-15 11:08:48 +02:00
Joakim Andersson
24f62eeea1 Bluetooth: GATT: Use UUID of attribute to check for a characteristic
Update check in the bt_gatt_attr_value_handle API function to use the
UUID of the function, in case the attribute has been declared with a
different read handler, or the attribute is a temporary object
where the read attribute has not been set.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-15 11:08:48 +02:00
Joakim Andersson
34cf1c74c2 Bluetooth: GATT: Fix regression in lazy loading of CCCs
Fix regression in lazy loading handling of GATT CCCs.
Bug introduced by: 00d370b09aa5dd1dc56986989989df6d4dd53bcf
The commit failed to account for ccc_set_direct calling ccc_set.

Fixes: #29150

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-14 17:35:22 +02:00
Joakim Andersson
c13588a508 Bluetooth: GATT: Improve service changed static RAM usage when disabled
Improve GATT service changed static RAM usage when the feature has
been disabled.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-14 17:18:35 +02:00
Joakim Andersson
374cbdd124 Bluetooth: GATT: Refactor use of 16-bit UUID core types
Refactor use of 16-bit common GATT UUID types where a complete UUID
object is declared on the stack only to use the 16-bit value.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-13 19:51:49 +03:00
Joakim Andersson
3346aa4d39 Bluetooth: l2cap: Reduce size of disconnect pool
Reduce the size of the disconnect pool required the full MTU
for a disconnect request.
Also completely remove the pool when not needed.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-13 13:13:50 +02:00
Vinayak Kariappa Chettimada
605ecf25a1 Bluetooth: controller: Fix debug pin for radio close
Fix the debug pin state when prematurely closing radio
events.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-13 10:13:54 +02:00
Vinayak Kariappa Chettimada
43d8e3c90c Bluetooth: controller: Fix missing return on Auxiliary PDU abort
Fix the missing return statement when Auxiliary PDU
transmission is aborted because Primary PDU does not have
the aux pointer setup. Also, directly stop clocks and
post LLL done, like being done in other state/role LLL.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-13 10:13:54 +02:00
Vinayak Kariappa Chettimada
77f12700e7 Bluetooth: controller: Minor conditional compile refactor
Minor Extended Advertising conditional compilation reorder
to better reflect the order Observer->Extended Scanning
dependency.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-13 10:13:40 +02:00
Vinayak Kariappa Chettimada
4b965c6174 Bluetooth: controller: Fix rx quota mismatch due to ext adv terminate
NODE_RX_TYPE_EXT_ADV_TERMINATE is generated in ULL context
and shall not increment received PDU quota value.

Fixes #29101.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-13 10:13:40 +02:00
Vinayak Kariappa Chettimada
babd7289eb Bluetooth: controller: Move bsim radio hal header
Move the bsim radio hal header for nrfxx into the
controller's hal folder.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-12 19:34:13 +02:00
Vinayak Kariappa Chettimada
9072f78abf Bluetooth: controller: openisa: Port drift implementation changes
Port minor anchor point synchronization drift implementation
changes.

Relates to changes in commit 732de50f67 ("Bluetooth:
controller: Refactor out drift compensation code").

Fixes #29062.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-09 13:46:46 +02:00
Vinayak Kariappa Chettimada
c1c627ce5a Bluetooth: controller: Fix Periodic Advertising cond. compilations
Fix Periodic Advertising conditional compilation to not
fail on undefined declarations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-09 11:41:34 +02:00
Vinayak Kariappa Chettimada
c440c0d92f Bluetooth: controller: Initialize close to locality of reference
Initialize auto variables close to locality of reference.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-08 17:29:08 +02:00
Vinayak Kariappa Chettimada
e50319e055 Bluetooth: controller: Check for ticker operation failure
Add assert check to detect failure to enqueue ticker
operations. This will avoid HCI thread from stalling
forever on k_sem_take.

This assert will trigger on design fault, not defining
enough queued ticker operations count.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-08 11:54:42 +02:00
Vinayak Kariappa Chettimada
75bb449d2d Bluetooth: controller: Fix missing NULL check
Added a missing NULL pointer dereference check and made the
structure member scan->per_scan.sync and timeout_reload as
volatile, as they are modified in ISR context.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
f71664a970 Bluetooth: controller: Added link struct allocation explanation
Added link structure allocation explanation related to HCI
event generation by the controller.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
44243f8e0c Bluetooth: controller: Use BT_INFO to log unsupported code path
Use BT_INFO to log missing support for Periodic Advertising
report generation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
2a1f134c32 Bluetooth: controller: Add Experimental keyword
Add Experimental keyword to LE Periodic Advertising in
Advertising and Synchronization state Kconfig title.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
cb67f36029 Bluetooth: controller: Rename to BT_CTLR_SYNC_PERIODIC
Rename Kconfig option BT_CTLR_SCAN_PERIODIC to
BT_CTLR_SYNC_PERIODIC.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
01006be29f Bluetooth: controller: Fix offset and offset units population
Fix the auxiliary pointer and sync information offset and
offset unit population. Offsets are 13-bit value, use 300 us
offset unit when offset value using 30 us offset unit does
not fit in 13-bits.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
56a7a46bc9 Bluetooth: controller: Fix SCA and Channel Map in Sync Info
Fix the population of SCA and Channel Map in Sync Info
structure.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
bf505fdf98 tests: Bluetooth: shell: Minor print format update
Minor print format update, updated format for Periodic
Advertising Interval, and added SID to be printed.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
66b95aa1d4 Bluetooth: controller: Fix set per adv recv enable HCI integration
Uncomment the code integrating the LE Set Periodic
Advertising Receive Enable command.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
f9a8507b4d Bluetooth: controller: Move identical ll_scan_params_set out
Move the identical ll_scan_params_set definitions out of
extended advertising conditional compilation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
2234515f96 Bluetooth: controller: Add missing Periodic Adv Sync resources
Add the missing resources like ticker instances, Rx PDU
buffers and memory queue link buffers, that are required
for Periodic Advertising Sync creation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
3a5eed8bac Bluetooth: controller: Fix Periodic Advertising Context leak
Fix Periodic Advertising Context leak on Sync Lost.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
f402435535 Bluetooth: controller: Remove redundant use of update check
Remove the redundant ticker update check, ticker is not
stopped and started in Periodic Advertising unlike in a
Connection Update Procedure in connections.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
0a56d57107 Bluetooth: controller: Fix own address type check
Fix the own address type check for whether local static
random address has been set.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
874c1452f1 Bluetooth: controller: Replace use of printk with BT_WARN
Replace printk in ISR with BT_WARN to avoid problems with
co-existing with logging subsystem.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
a5983e1237 Bluetooth: controller: Fix memory alignment violation
Fix memory word access alignment violation that causes
hardfault in nRF51x SoC.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
abebdb2f52 Bluetooth: controller: Fix cond. compilation for broadcaster
Fix compilation error when building only broadcaster support
in an application.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
0de3943bb6 Bluetooth: controller: Do not generate sync lost on terminate sync
Remove generation of Periodic Sync Lost HCI event generation
that is not needed as per BT Spec. v5.2 Vol.4 Part E.
Section 7.8.69.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
c23b1a27a7 Bluetooth: controller: Fix uninitialized rl_idx value
Fix uninitialized rl_idx value for the Extended Advertising
PDU received in the auxiliary channels. This caused
uninitialized rl_idx to be used by HCI layer and fail an
assert check in ull_filter.c file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
62e8572df7 Bluetooth: controller: Fix missing periodic advertising start
Fix missing periodic advertising start due to missing
allocation of auxiliary context when no Extended
Advertising PDU on auxiliary channels.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
aec99da741 Bluetooth: controller: Remove cond compile on struct definition
Remove conditional compilation on structure definition in
pdu.h so as to allow inclusion of header files with
function prototypes that use those structures. I.e. to
avoid conditionally including the header file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
baef416d5d Bluetooth: controller: Added Periodic Sync Terminate and Sync Lost
Added implementation to perform Periodic Sync Terminate,
generation of Sync Lost on terminate and on remote device
termination of Periodic Advertising.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
d1f4611ad8 Bluetooth: controller: Add Periodic Sync drift compensation
Added implementation to handle Periodic Advertising clock
drift in the created Periodic Advertising Sync instance.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
31f2196abd Bluetooth: controller: Fix auxiliary channel scanning
Fix auxiliary channel scanning to capture the PDU end
timing that is need to correctly setup Periodic Sync.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
422d8b1466 Bluetooth: controller: Fix correct CA in Periodic Advertising
Fill the correct local clock accurracy in the Sync Info
structure in the Periodic Advertising.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
b2dcfa7ace Bluetooth: controller: Refactor the order of file static function
Refactor the order of file static function to be consistent.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
90cfe1dc66 Bluetooth: controller: Fix minor conditional compilation
Fix minor conditional compilation around extended advertising
and scanning.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
732de50f67 Bluetooth: controller: Refactor out drift compensation code
Refactor out drift compensation implementation so as to
reuse it for Periodic Sync feature.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
057653c220 Bluetooth: controller: Initial implementation of Periodic Sync setup
Added initial implementation of setting up of Periodic Sync
and scheduling the Radio Events.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
ff4546dced Bluetooth: controller: Refactor out common lll_abort_cb function
Refactor out common lll_abort_cb function so that it can be
used across Periodic Advertising and Periodic Advertising
Sync creation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
2627524162 Bluetooth: controller: Refactor out clock ppm interface
Refactor out clock ppm interface so that it can be reused
for Periodic Advertising Sync feature.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
a0612dabe1 Bluetooth: controller: Implementation of Periodic Sync Create Cancel
Implementation of Periodic Sync Create Cancel.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
f9380dbf48 Bluetooth: controller: Implementation of Periodic Sync Create
Implementation of Periodic Sync creation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
e533f99f04 Bluetooth: controller: Initial implementation of Periodic Sync LLL
Added initial implementation of LLL layer of Periodic Sync
creation feature.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
96dd0ef9d8 Bluetooth: controller: Minor internal comments updated
Minor updates to internal comments.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00