For the CAP acceptor the size and rank characteristic shall
be set as per the CAP spec. Add checks for 0, as 0 indicates
not initializing the characteristics in the CSIS instance.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adds parsing of Private Network Identity parsing in the proxy client,
allowing the client to use these messages to establish a GATT
connection.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
BT_CTLR_ISOAL_LOG_DBG_VERBOSE, BT_CTLR_ISO_TX_SEG_PLAYLOAD_MIN, and
BT_CTLR_CONN_ISO_AVOID_SEGMENTATION are very tied to the BT_LL_SW_SPLIT
implementation. It is very unlikely that these will ever be used by
another controller
Therefore move them out to the BT_LL_SW_SPLIT specific configuration
file. This will likely create less confusion when using another
controller.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Update the BSIM test and the shell to use
bt_audio_codec_cfg_set_chan_allocation rather than implementing
their own versions.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The BAP unicast babblesim tests now does RX and TX
and verifies that the data is correctly received on both
the client and server.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Refactor the codec_cfg_get_frame_duration function to return the
assigned numbers value, instead of a converted value, but with
support for converting the value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Since the default process dhkey gen in bt rx, will block send
Trans Ack, cause peer device send more package.
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
Since notice that simultaneous advertising is not only used
by relay message, provision over pb-adv can also be used.
so it was changed to a more general name.
refs:https://github.com/zephyrproject-rtos/zephyr/pull/48903
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
This will truncate ATT notifications/indications if exceed ATT MTU size.
It is up to the client to exchange MTU.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes sending proper Preset List notifications after
reconnection. The issue was observed when the last preset
known to the client has been removed.
As we do not hold the information about the deleted presets,
we need to use Generic Update procedure to:
1. Notify the presets that have been removed in range
(PrevIndex = current_preset_last, Index=previous_preset_last)
2. Notify deletion of preset Index=previous_preset_last.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Some of the data shall be persistent across connections to bonded
clients. This includes notidication state flags that are used to
determine whether notify bonded client after reconnection.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This refactors the preset list to use sys_slist API. There have been
various issues seen while iterating presets, thus it's more save to use
well-defined and tested sys_slist API.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Defer sending the features, active index, preset list and preset read
response to sysworkq and retry sending in case failed due to buffers not
available at the moment.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Verify that a HAS Server IUT sends changed characteristic notifications
or indications when the Lower Tester reconnects.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This moves common code to set_preset_availability function to be called
from bt_has_preset_available and bt_has_preset_unavailable.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes missing setting of FLAG_CONTROL_POINT_NOTIFY flag that
indicate whether submit control_point_work. In case the there are more
indications/notifications to sent (is_last flag is unset), the
FLAG_CONTROL_POINT_NOTIFY shall be set to resubmit control_point_work.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This removes revering the features value back to previous state if work
submission failes. Even if it fails it indicates an internal sysworkq
issue, so even retry won't help. The client can read the features value
anyway, thus it's sane to just log an error in such case.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Rename the Kconfig option from BT_ISO_ADVANCED to
BT_ISO_TEST_PARAMS to more explicitly denote that it
enables support for using the ISO test parameters.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Check whether peer is subscribed for ASE state notification before
calling bt_gatt_notify. This handles an assert thrown when the
notification failed to be sent.
Fixes: #63728
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
If the PA gets terminated, we clear the pa_sync field of the
corresponding broadcast sink object.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
For some reason the state_change variable was static, which
does not make any sense. Changed it to a regular local
bool in bt_bap_scan_delegator_mod_src.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Commit makes workable proxy solicitation functionality
only server part without dependencies on client part.
Only on demand proxy server is required.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
The `upload_status_rsp_with_progress` function uses the currently set
slot pointer to set firmware id field in the message. If another
upload starts but the firmware is already received, the slot API won't
let us to set the fwid and will return an error code. In this case, the
slot pointer stays invalid as fwid wasn't set, and
`upload_status_rsp_with_progress` will not add fwid as the lenght is
zero.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Fix hung Controller when establishing CIS on an encrypted
ACL connection with Controller built with direction finding
support enabled.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When the bt_bap_broadcast_source_reconfig was supplied with a subset
of the streams, it would only update the codec cfg and qos for the
streams provided in the parameters.
This commit changes that, so all streams are properly updated,
as they share some common values.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When calling bt_bap_broadcast_sink_delete, the broadcast sink
should not attempt to terminate the PA Sync. The PA sync can live
on without the broadcast sink, just as the broadcast sink can live
on without the PA sync (which is why the PA sync check was completely
removed).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When updating the Scan Delegator receive state, we shall only
set the BIS indexes in bis_sync that we are actually synced to.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If the previous upload was in-band and it didn't complete, the slot will
stay reserved. By design we release slot not at the end of the upload
phase, but at the start of a new upload phase.
This fixes DFU/SR/FD/BV-13-C.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
If a Fw Distribution Client sends the Upload OOB Start message, but the
application layer didn't call bt_mesh_dfd_srv_oob_check_complete yet,
we have no other option other than ignore the message. The next phase
in this case could be Transfer Active, Transfer Success or Failed and it
will be set only after Check Firmware OOB procedure completes.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This message _at least_ 2 bytes long, but can be longer, thus
BT_MESH_LEN_MIN should be used.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
In OOB upload, when Check Firmware OOB procedure completes successfully
and the firmware is already received, we send Firmware Distribution
Upload Status message with update Phase set to Transfer Success. In this
case, we must set Upload Progress to 100%. This can't be done through
the callback as the application layer doesn't yet know that the firmware
is already received. This will happen by the exist from
bt_mesh_dfd_srv_oob_check_complete function, which will return error
code -EEXIST.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
According to the ASCS_v1.0 the ASE in Streaming state shall transit to
QoS Configured state when link loss happen.
Relates: ES-24215 (errata)
Fixes: BAP/USR/SCC/BV-168-C
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
rand32.h does not make much sense, since the random subsystem
provides more APIs than just getting a random 32 bits value.
Rename it to random.h and get consistently with other
subsystems.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
The list of receives in the Firmware Distribution Server model and
and the Firmware Update Client model are 2 different lists.
In the Firmware Update Client model it is called the Update Receives
state and the Active Update Receivers state which is a subset of
receivers from the Update Receivers State. In the Firmware Distribution
Server model it is called the Distribution Receivers List state.
When Distribute Firmware procedure starts, in the Initiate step, the
Receivers List input (which is the input for the Update Receivers
state), is composed of the Distribution Receives List state. During DFU,
the Update Receivers state becomes the Active Update Receivers state
which keeps only active nodes. Timed out or failed nodes dropped out
from this list. The Distribution Receivers List state stays unchanged
and thus don't need to be populated again after every successfull and
failed DFU.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Added offset to the model relation register for vendor
models to find correct model index
for Composition Data Page 1. The previous implementation used the
'mod_idx' from the 'bt_mesh_model' struct, which led to issues in the
model relation register due to SIG and vender models having the same
model index.
Modified existing functions related to the model relation
register to take in the offset.
Modified macros for determining if a model is a base- or
extending model.
Added check in 'add_items_to_page' to check whether the model relation
is an extension.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
Changed buffer length check in bt_mesh_comp_p1_elem_pull.
The previous threshold would result in the
method not detecting the final element when it consisted of just one
model.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
When compiling conn.c using arm-none-eabi-gcc version 11.3.1 20220712
with the -Wmaybe-uninitialized flag a warning is emitted due to
pending_no_cb not being initialized. I'm not sure if initializing it to
NULL is the "correct" fix, but it's certainly not any worse then it being
uninitialized, and it fixes the warning.
Signed-off-by: Dennis Grijalva <dennisgrijalva@meta.com>
Connection states are non-trivial to understand based on their names
only, so add short descriptions in the header file explaining what they
do.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Fix errenous return value in pacs_gatt_notify function. The function
would always return zero, and not forward the error correctly.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
Don't reset values set in init callback as it is called only once by
bt_mesh_init call. The reset callback is called on every node reset.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
A few of the length checks that deal with HCI packets coming from the
controller were using assert statements. But the recommended practice is
to drop invalid packets and continue execution whenever a malformed
packet arrives from an external source, so replace those assert
statements with branches that will drop the packet and return.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Fixed issue when reprovisioning is done on a device with
both RPR client and server on the same device.
Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
The existing formula for the amount of data that can be filled
in in the current PDU is correct but confusing. Replace it with
a simpler formula.
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Updates the chaining for advertising.
Instead of unconditionally adding a new PDU when new data
is added we now instead fill the last PDU in the chain with
the incoming data, only adding a new PDU when there is
not enough room.
This reduces the nr. of PDUs used for advertising, and also
fixes some qualification failures
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
The indexes were reset to 0 for each subgroup, which meant
that if we had a broadcast source with 2 subgroups and
1 BIS in each, both of them would use index 0x01.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
A race condition between ATT RX and the connection teardown can happen, as
the teardown is executed from a workqueue.
For example:
- connection is established
- `connected` cb is called (in BT RX context)
- user calls `bt_conn_disconnect` in that cb
- connection is marked as disconnecting
- ATT teardown & general conn cleanup is scheduled
- BT RX gets an ATT request, tries to handle it
- ATT bearer is still not GC'd, so it tries and fails to send it
-> results in error message "not connected" on log
- ATT teardown & general conn cleanup runs
To avoid that, we not only check the bearer state, but also its ACL conn
state.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Fix leak in scheduled ticker node when rescheduling ticker
nodes.
Applications having active Extended Advertising or Observer
role with the use of ticker reschedule in window feature
would experience assertion check failure due to delayed
radio event preparation or stalled controller with no active
roles.
Fix updating of the ticker linked list when handling
rescheduled tickers.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When the legacy LLCP implementation was removed this Kconfig option was
mistakenly left over. Remove it now with all its users.
Fixes#63212.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This module calls `log_output_*` functions so it should enable
the `LOG_OUTPUT` Kconfig option explicitly.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Make the aa argument const to solve a Coverity issue
that assumes that any value that is being byteswapped
is tainted. Making the argument const should avoid
this assumption from Coverity.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix the coverity issue CWE570, comparison of unsigned int to 0
in the definition of IS_SYNC_ISO_HANDLE
There is a potentially the same issue for IS_ADV_ISO_HANDLE,
fixed that as well
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
If RPR server is used then Mesh settings work queue
requires more size during provisioning procedure.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
The check for number of streams in a subgroup was reversed, so
it would never allow for correct values.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added run-time BT_CENTRAL role check for the path that was
central specific and did not have such check.
When multi-role BT device tried to pair without bonding (peripheral role)
while already previously bonded with the same device on another
Bluetooth identity, pairing failed.
It executed central-specific code, which should not be executed in case
when the device acts as peripheral (as it is even opt-out from code when
CONFIG_BT_CENTRAL is not enabled).
Signed-off-by: Mateusz Kapala <mateusz.kapala@nordicsemi.no>
In ll_setup_iso_path cis is only ever set if CONFIG_BT_CTLR_CONN_ISO
is enabled, and similarly adv_stream is only ever set if
CONFIG_BT_CTLR_ADV_ISO is enabled.
The two assignments were reported as dead code by Coverity due
to this, which has been fixed by guarding the code with
the respective Kconfigs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
BT_SECURITY_FORCE_PAIR option gets overridden when CONFIG_BT_SMP_SC_ONLY
or CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY is defined. Cache the bit value
before overrides.
Add explicit forced pair handling to existing security level check.
Functionality did not change as this was done implicitly due to integer
comparison for enums.
Add extra clarification to the method doc.
Signed-off-by: Rait Rääk <raitraak@gmail.com>
Remove the terminate_ack from struct ll_conn since it is
not used anywhere, and results in dead code.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The remaining bit should be zero if auth is
shorter than PROV_AUTH_MAX_LEN and it should
be trimmed by removing octets with indexes
higher than PROV_AUTH_MAX_LEN.
Signed-off-by: Alperen Şener <alperen.sener@nordicsemi.no>
Fix issues when setting new values in cfg that modify
the length of the codec configuration LTV value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added comment to KConfig.iso file to make description
of BT_ISO_TX_MTU and BT_ISO_RX_MTU more clear
Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
iso_has_ts wasn't set correcrly for fragments of HCI ISO Data packets,
now it is set depending on timestamp
provided in the original buffer provided by host user
Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
this commit partially reverts e460847b60
According to Core Spec 5.4, Vol. 4, Part E, 5.4.5, Data_Total_Length field
contains length of the whole packet including optional fields of SDU
(Time_Stamp, Packet_Sequence_Number, ISO_SDU_Length, RFU and
Packet_Status_Flag). In Zephyr Host, Data_Total_Length value
is stored in bt_dev.le.iso_mtu field.
Therefore, there is no need to calculate iso_hdr_len(),
this length is already taken into account in conn_mtu(conn).
This commits removes iso_hdr_len() function and fixes
calculation of HCI ISO Data packet length calculations.
Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
Fix number of completed packets generated when BIS HCI ISO
Data packets sent to Controller are in fragments. Use the
ISOAL stored sdu_fragment count to generate the number of
completed packets count.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Kconfig option to turn off ISO Data Packet Sequence Number
use to place the ISO Data in the correct radio event,
instead simply buffer it to next radio event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ISO data timestamp to reflect the SDU reference point
and not the ISO event anchor point when PDUs received after
retransmissions.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use of payload_count for supporting flush timeout in
Central and Peripheral ISO Lower Link Layer.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Update the function name from codec_cfg_get_chan_allocation_val
to just codec_cfg_get_chan_allocation, and add
codec_cfg_set_chan_allocation.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add the bt_audio_codec_cfg_set_frame_blocks_per_sdu function
to set or add the frame blocks per SDU field in the
codec configuration.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix a clang warning
ull.c:1235: warning: use of bitwise '|' with boolean operands
The result of ({1/0} &&(int)) is either true(1) or false(0),
not the int and therefore bm is not a bitmask, but just true(1)
or false(0) all together.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Add the bt_audio_codec_cfg_set_octets_per_frame function
to set or add the octets per frame field in the
codec configuration.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Split the bt_audio_codec_meta_get functions to cfg and cap
variants. This provides a more explicit API where users
do not need to dereference their cfg/cap structs in order
to use this functions.
Furthermore this will also make the get functions more
similar to the upcoming set functions, where the set functions
will require the use of the cfg and cap structs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The firmware on these devices seems to have a bug that can cause reordering
of received packets. This can lead to new GATT requests being received
before the acknowledgement of the previous GATT response, accompanied by
log messages like the following:
<wrn> bt_att: bt_att_recv: Ignoring unexpected request
Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
Refactor the codec_cfg_get_freq function to return the assigned
numbers value, instead of a converted value, but with
support for converting the value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
For asymetrical features there needs to be a separate mechanism to
unmask features in peer. This must be used in central for unmasking in case
of 'unsupported in peer' condition for CIS Create.
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
If a CIS create is requested prior to having a complete feature exchange
the central will initiate a feat exch before enqueing the CIS create.
IF then the feature exchange results in peripheral NOT supporting
CIS create the central needs to allocate an RX node for the NTF
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
The purpose of this test is to prove that the zephyr host can handle the
behavior described in the Bluetooth Core Specification Vol.3 Part.F
3.3.2 "Sequential protocol".
The host should be able to handle all of those in parallel: one
indication, one write request, multiple commands and multiple
notifications.
The "tester" part had to be written with a "tiny host" implementation
instead of the Zephyr host, as the ZH conflates GATT client and server
and doesn't allow a device to enqueue an ATT request + an ATT indication
on the same bearer.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
If the peer is a zephyr host, there is no problem, as the Zephyr
host limits sending parallel REQs and INDs.
But the spec allows sending those in parallel, and it may end up that
the re-used REQ buffer hasn't been destroyed when an indication comes.
Only re-use the buffer when enqueuing ATT responses.
This means that we may run out of buffers if the peer sends too many
indications and our application also sends a lot of commands/notifications.
The rationale for this is that having to handle a lot of requests is a
more plausible scenario (e.g. being discovered by multiple peers) than
handling lots of parallel indications.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Fix ULL_HIGH ticker operations count, it is discovered in
new BabbleSim test implementations that mesh tests using
Extended Advertising and Scanning enqueue upto 4 ticker
operations before ULL_LOW ticker_job could process it.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
bt_iso_cig_reconfigure would almost always fail due to invalid
checks that did not take the functioner properly into account.
The CIS provided to bt_iso_cig_reconfigure can now be allocated
beforehand, if the CIG for the CIS is the same as the one being
reconfigured.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In `gatt_write_ccc_rsp`, the third field of
`SYS_SLIST_FOR_EACH_NODE_SAFE` was use as the `prev` sys_node when
calling `gatt_sub_remove`. This was wrong because the third field of
`SYS_SLIST_FOR_EACH_NODE_SAFE` is actually the next node.
Fix the issue by adding a pointer to the previous node and passing it to
`gatt_sub_remove`.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Fix BIS implementation for checking overrun of the BIS PDU
sliding window buffer overrun.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Provisioner should be able to manage received capabilities
unconditionally. Mandatory oob authentication is the node
feature and it is still compile time feature.
Split handling of this feature on provisioner and node part.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
According to specification it is possible to provide
static oob value with any length. Mesh should trim or
append\prepend by zeroes if it is longer\shorter than
required value.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Add BT_CTLR_EVENT_OVERHEAD_RESERVE_MAX Kconfig to allow the
omit of EVENT_OVERHEAD_START_US and EVENT_OVERHEAD_END_US in
the time reservation calculations.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This change from using the mechanic of CONFIG_BT_KEYS_OVERWRITE_OLDEST
to instead handle the bonding cache through bond_deleted.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
Added retry mechanic to CSIP notifications by adding them into system
workqueue. Bookkeeping is done for notifications for all clients, and
potentially disconncted clients will also receive notifications on
reconnect. This also adds mechanic to restore the local clients list
upon registration of the service, as well as BSIMs to test notify on
reconnect.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
Reformated csip_set_member to use atomic flags for notifications
instead of a pending notification array. This better conforms the
style of the code to how its done in other LE Audio services.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
Back-to-back Tx Rx implementation was incorrect for nRF53
that uses DPPI. Both current and next DPPI channels where
enabled in the implementation which only worked correctly
to have the right tIFS when current and next PDU length
were same.
Fix ensures that the correct current DPPI is subscribed
to by the radio subscribe.
The implementation has been refactor to be able to use the
current sw_tifs_toggle value in the HAL implementation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix CIS assymmetric PHY usage by adding implementation to
use correct PHY in radio when switching transceiver.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing NRF_CCM subscribe clear which can lead to
spurious trigger of TASK_CRYPT in NRF_CCM. This may
lead to corruption of Rx PDU buffers.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
hal_radio_tx_chain_delay_ns_get() was incorrectly
returning the microsecond value, resulting in a 1us
error in the timing => Fix it.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Align the header a bit with the one for the real radio,
adding missing Tx power levels and removing TODO which did not
need doing.
The old one originated as a copy of the nrf52833 one, and did not
evolve like the real ones.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Remove a few macros which are not used anywhere in the tree.
For the sake of simplifying the header and easing its understanding.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The following changes have been done:
1.
HAL_SW_SWITCH_GROUP_TASK_DISABLE_PPI_REGISTER_TASK(index)
= HAL_SW_SWITCH_GROUP_TASK_DISABLE_PPI_TASK(channel)
has been convered into
HAL_SW_SWITCH_GROUP_TASK_DISABLE_PPI_REGISTER_TASK(index, channel)
2.
HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI_REGISTER_TASK(index)
= HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI_TASK
Which was only used in one place, has been replaced with the
equivalent HAL call
3.
HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI_REGISTER_TASK(index) = 0
was replaced with the HAL subscribe clear function
nrf_dppi_subscribe_clear(NRF_DPPIC,
HAL_SW_DPPI_TASK_EN_FROM_IDX(SW_SWITCH_TIMER_TASK_GROUP(index)));
4.
NRF_DPPIC->SUBSCRIBE_CHG[group].EN/DIS = 0;
have been replaced with the equivalent HAL clear call
5.
NRF_DPPIC->TASKS_CHG[group].DIS = 1;
have been replaced with the equivalent hal task_trigger() call
6.
Manually setting the CHG registers, has been replaced with a
clear + add (because the hal does not have a set function yet)
So,
NRF_DPPIC->CHG[group] = value
has been replaced with
nrf_dppi_group_clear(NRF_DPPIC, group);
nrf_dppi_channels_include_in_group(NRF_DPPIC, value, group);
(A set function has been requested from the HAL team)
Note: There is other direct registes writes to the dppi subscribe and CHG
registers in the coded phy parts which have not been changed yet.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This requirement was implicit as the only backend the host is currently
tested with behaves this way.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Fix regression in sw switch single timer id use for nRF53x
series SoC.
Regression introduced in commit cfcbe5d68e ("Bluetooth:
Controller: Remove redudant header file includes").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Rename the bsim header in preparation for having more
simulated targets.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
To avoid a build error when coded phy is not enabled
for a nrf53: These three functions are only used for coded phy,
and depend on macros which are only defined if coded phy
is enabled.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Switch use of kconfig:
* SOC_SERIES_NRF53X -> SOC_COPATIBLE_NRF53X
* SOC_NRF5340_CPUNET -> SOC_COMPATIBLE_NRF5340_CPUNET
to also select those options/code when building for
the nrf53 simulated targets.
Also switch three kconfig range dependencies from
SOC_SERIES_NRF52X to SOC_COPATIBLE_NRF52X
(IRQ priority related) for consistency. These sound
not really have an impact.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Fix assertion due to late Peripheral CIS active flag being
initialized. CIS active flag shall be initialized when it is
acquired.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Maximize BIG event length to extend upto ISO interval, and
allow PTO and Control subevents to be pre-emptible.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Calculate Broadcast ISO event overheads due to extended and
periodic advertising events.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing Coded PHY implementation conditional compile
causing compile error when disabling Coded PHY support in
SoCs that have radio that support Coded PHY.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Revert EVENT_OVERHEAD_START_US value for Coded PHY support,
needed to pass LL/DDI/SCN/BV-21-C and LL/DDI/SCN/BV-25-C.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Reduce number of successive calls to ticker_job() by
disabling mayflies in the ULL_HIGH priority, enqueue
ticker_yield_abs() and ticker_start() before re-enabling
so that single ticker_job() handles both yield and start.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix short prepare handling when more than one event is
enqueued in the pipeline and the short prepare is placed at
the end of the prepare pipeline.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ticks_slot_window use in Observer, do not use for
unreserved continuous scanning, and do not use when scanning
on both 1M and Coded PHY simultaneously.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use ticker_ticks_diff_get consistently when calculating
difference between ticker ticks when determining short
prepare requests.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use the state/role context parameter in prepare pipeline
to identify the preempt timeout that was setup.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
These change are reverted as part of fixing regression
failure in LL/DDI/SCN/BV-21-C and LL/DDI/SCN/BV-25-C.
This reverts commit 0d54ca8761.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add support for reading and writing long values (> MTU)
when using the CAP API.
This change does make it slightly slower to execute the
CAP procedures as it is now done on a one-by-one basis,
which affect multi-ACL setups, but that also means
that the buffer requirements for CAP will generally be lower.
There is still room for improvement as we can perform the BAP
operations in parallel on each ACl, which should return this to
its former performance.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add parsers to retrieve metadata values from codec
capabilities and codec configuration structs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Modify the order of operation in
broadcast_sink_iso_disconnected so that when the application
gets the last stopped callback, the BIG has already been cleaned
up, and the broadcast sink is in a reusable state.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Instead of calling ase_release for each ASE in the ACL
disconnected callback, we now call the state_transition_work_handler
directly. This is to ensure that when the disconnected callback
returns, the bt_conn object has been properly unref'ed in
a timely manner.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Replace the BT_AUDIO_CODEC_LC3_ID macro with the
BT_HCI_CODING_FORMAT_LC3 as there is no reason to
define and use the LC3 ID different than the other
allowed codec IDs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When using BT_HCI_CODING_FORMAT_TRANSPARENT as the codec_id, the
codec configuration (cc) len sent to the controller shall be 0.
Since this goes for all devices, we ensure that we don't
send invalid codec ID and cc data over air.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Modify the bt_bap_broadcast_source_reconfig to use the same
parameter struct as bt_bap_broadcast_source_create so that
the two are more similar, since they both set the same values.
This allow for full control of which subgroups and stream
are updated.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix the order of setting the flag that indicates that
preempt timeout has been successfully requested versus
the request is waiting to be scheduled.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ticker implementation to prefer to keep ticker node
started in case of race condition to start and stop.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add state checks for the get_id and get_base functions, as the
ID and base are not valid when the state of the broadcast
source is BT_BAP_EP_STATE_IDLE.
Since the broadcast_source_get_state uses the slist functions,
the broadcast source object for bt_bap_broadcast_source_get_id
can no longer be `const`.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Intent is to pass Ellisys ISOAL quality tests for framed TX scenarios
where the TX SDU includes a time stamp that is not based on the
controller's clock.
Changes:
-- Include controller's reception time as a separate field in the TX SDU
information
-- Include decision on whether SDU time stamp is valid and based on the
controller's clock
-- Arbitrate and select / compute time stamp for the SDU
Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
Changes:
-- Corrected reading and writing time offset in framed segment header to
account for endianness
-- Corrected bit positioning of time offset bit field in the segment
header structure definition
-- Fixed upstream Zephyr BSIM test build failure due to debug logging
39-bit variable
Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
Changes:
-- Disregards target event after segmenting the first TX SDU and instead
decide event based on the next payload and feasibility to fragment
for that event (time-offset > 0)
-- Corrected error SDU release logic when an error occurs while
expecting the start of a new SDU, to avoid releasing an SDU which
could be received in the next payload or event
-- Included additional debug logging
Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
Revert back the EVENT_OVERHEAD_END_US value to original
value in initial commit 5c3709c13f ("bluetooth:
controller: Add def's re. update to slot reservation calc").
40 us is a sufficient margin considering ~30 us being the
worst case Rx chain delay for S8 Coded PHY on nRF5x SoCs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This adds support for the Upload OOB Start message to the DFD server, by
providing callbacks that the application can use to hook any OOB scheme
into the model behavior.
There are also extensive changes to the dfu_slot module, to accomodate
the new needs that appeared with the support for OOB transfer (mainly,
fwid, size and metadata are no longer available when the slot is
allocated, they appear later in the handling).
Signed-off-by: Ludvig Samuelsen Jordet <ludvig.jordet@nordicsemi.no>
Convert the driver to a dt-based device. Also update Kconfig so that it
depends on the right compatible being enabled, initialize in POST_KERNEL
(APPLICATION should not be used for devices) and remove one redundant
include.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
The device model was not used for anything useful, only to call some
init code. Change to SYS_INIT instead.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Fix missing lazy calculation when using ticker interface
required for Central CIS create.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix initialization of CIS lazy_active event count used when
first CIS event is active. Now initialization for first and
any subsequent CISes made active.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This patch amends the existing L2CAP accept callbacks to use the new
accept signature that includes a pointer to the L2CAP server structure.
Signed-off-by: Donatien Garnier <donatien.garnier@blecon.net>
Add a pointer to the associated server structure in the L2CAP accept()
callback. This allows the callee to know which server an incoming L2CAP
connection is associated with.
Signed-off-by: Donatien Garnier <donatien.garnier@blecon.net>
The bt_conn_exists_le is commonly hit by users attempting
to connect (either as central or peripheral) to a device
they are already connected to in some way. The current log statement
does not provide particularly much information, so added more.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix some compiler instruction re-ordering. Mayfly code with
cpu_dmb() help avoid stalled memq_ull_rx processing when
rx_demux is to be executed using mayfly.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Even though the OOB information is optional we can add it
to extended scan reports in cases there is detected unprovisoned
devices.
Referring to MshPRT section 4.4.5.3:
When the Remote Provisioning Extended Scan procedure completes without
receiving an advertisement from the unprovisioned device, the
OOBInformation and AdvStructures fields shall be skipped. When the
obtained data is empty, the AdvStructures field shall be skipped. The
Status field shall be set to Success.
and referring to MshPRT section 4.3.4.9:
The OOBInformation field contains the OOB Information of either the
unprovisioned device or the Remote Provisioning Server.
Signed-off-by: Alperen Şener <alperen.sener@nordicsemi.no>
Stores persistent on-demand private GATT proxy state in separate
settings entry. This is implemented to avoid issues related to
backwards compatibility between device firmware updates.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Stores persistent private beacon state in separate settings entry.
This is implemented to avoid issues related to backwards compatibility
between device firmware updates.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Makes the long workqueue init priority configurable and sets
the default to 50, this is to allow for relocating bluetooth
libraries to other parts of memory e.g. external flash, and
allows for those flash drivers to be initialised prior to
calling functions residing in them.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
cur_inst is the copy of ots_client instance to prevent duplicate
API call while client is in middle of read/write procedure.
But cur_inst can only be cleared while write_obj_tx_done or read rx_done.
If ACL is disconnected while read/write is on-going, there is no chance
for cur_inst being cleared.
This causes ots client will no longer perform select/read/write
procedure anymore. API will always return -EBUSY.
Let l2cap_disconnect check if cur_inst is NULL and NULL it
unconditionally as what it is designed.
Make bt_ots_client_unregister public API.
Signed-off-by: Pirun Lee <pirun.lee@nordicsemi.no>
This adds endpoint by stream lookup function used to find the active
endpoints that use the stream object provided. The function is used
instead of dereferencing stream->ep that may be not valid if application
did not memset the stream object.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Once the application bt_bap_stream_ops.released callback is called make
sure the stream->ep pointer is valid so that application can still access
the endpoint details like e.g. endpoint direction.
Fixes: ASCS/SR/ACP/BV-{24,25,26,27,28,29,30,31}-C
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
When using the LC3 codec, the cid and vid fields of the
codec shall both be 0x00, as per the BAP and ASCS specs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Use the HAL event clear functions to clear EVENTS
instead of accessing the registers directly.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>