Use UTIL_CAT which resolves input arguments instead of direct
preprocessor concatenation.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Enable debug pins when TF-M has been enabled for the image.
This would otherwise produce an error message as the DEBUG_SETUP would
not have been defined for the non-secure image.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Fix missing ISO Data packet received by Synchronized
Receiver due to incorrect check on sink handle that did
not permit handle value of 0.
Fixed function to get ISO stream context to check for
valid ISO sync context, i.e. not being terminated.
Regression introduced in commit 7c89f1fe9f ("Bluetooth:
controller: Support for separate ISO RX data path").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The changes smp_process_request_packet to return MGMT_ERR_ECORRUPT
in case when failed to read header.
This helps to recognize that there will not be any response sent
from mcumgr to the buffer given to smp_process_request_packet as
it has not been recognized as valid request.
It also removes redundant check on mgmt_streamer_init_reader which
always returns 0 (no failure) in Zephyr.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The previous approach to detect if the underlying transport was closed
(by checking the return value of `mbedtls_ssl_read()` was not right,
since the function call does not request any data - therefore 0 as a
return value is perfectly fine.
Instead, rely on the underlying transport ZSOCK_POLLHUP event - if it
reports that the connection ended, forward the event to the application.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Report ZSOCK_POLLHUP event if peer closed the connection, and thus the
socket is in EOF state.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The mcumgr image upload uses buffed flash writes with use of stream
flash, which makes flash alignment check unneded.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Fix implementation to check for empty ADV_EXT_IND and
ADV_SYNC_IND PDUs, and not parse them incorrectly.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix implementation to limit Periodic Advertising data to a
configurable maximum length when generating HCI reports.
Bluetooth Test Specification defines Scan_Max_Data value
in IXIT. When HCI LE Periodic Advertising Report events are
generated by assembling the chain PDUs, the test cases
expect that if the data length is no more than
Scan_Max_Data, then at least once the IUT shall not
truncate the data in the advertising report.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Remove redundant parameter pass of lll_aux to isr_done as
the auxiliary context use is always for scan context as the
parent.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Minor refactor of auxiliary scanning implementation to use
consistent variable naming and assignment close to its
locality of reference.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Rename per_scan field in scan context to periodic field to
avoid confusing with abbreviation for peripheral.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When the periodic advertiser list is used,
the address and SID may not be identical to those passed in by
the application.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
The CPU power states were declared with a typecast array literal,
which is a GNU extension.
Unfortunately some compilers (xt-xcc even in very recent versions,
when used with -fdata-sections) will die with a compiler error when
those rvalues are used in an expression that also takes their address,
e.g.:
/* this all by itself crashes xcc -fdata-sections */
int *foo = (int[]){0};
Declare the array elments in two steps, making the code standard C.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
`gatt_req_alloc` will wait until a `req` is free (or until timeout).
`req`s are freed on the BT RX thread in calls into bt_att_recv.
When `gatt_req_alloc` called on the BT RX thread itself when there are
no free `req`s, it will block the BT RX thread and deadlock. The
deadlock lasts until timeout.
This change detects this condition and returns the failure early.
Fixes https://github.com/zephyrproject-rtos/zephyr/issues/39624 where
if `bt_gatt_write` is called from BT RX thread (as can happen if it is
called from a bluetooth callback), the BT RX thread can be blocked and
prevented from processing the request responses and unblocking itself.
This was the cause of a soft 30s deadlock until gatt_req_alloc timeouts.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
`gatt_write_ccc` may fail if it is unable to allocate a `bt_att_req`.
This change adds handling of this case to `bt_gatt_unsubscribe`.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
tc_util.h is also included by unit tests and in that case it
cannot have dependencies to subsystems. Including log_ctrl.h
only for ARCH_POSIX where it is needed to flush logs before
exit.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Fix Periodic Advertising implementation to setup Power
Amplifier (PA) GPIO toggle for transmission instead of
incorrect Low Noise Amplifier (LNA) setup which is for
reception.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Define EVENT_SYNC_B2B_MAFS_US to use the Kconfig option
used to configure the MAFS between Periodic Advertising
chain PDUs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix Periodic Advertising ADI Support feature bits so that
it is return back in the Read Local Supported Features.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix Periodic Advertising Sync LLL scheduling flag to not be
set when chain PDUs use LLL scheduling, only set when
primary AUX_SYNC_IND PDU received use LLL scheduling.
Without the fix, spurious EVENT_DONE_EXTRA_TYPE_SYNC would
be generated when chain PDUs are failed to be received. This
can cause Sync Lost message to be generated.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The lll_scan_aux.c file does not compile when the new LLCP is
selected due to missing conditional compiles.
Conditional compile and proper tx_times are selected with this
commit
Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
If any specific stream callback is attempted
to be called but is missing, a BT_WARN log statement
is added.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add support for the BAP broadcast sink role. This role
allows a device to sync to a broadcast ISO stream.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add the BAP unicast client implementation. This role
can discover BAP unicast server services and initiate
BAP audio streams.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add the Basic Audio Profile (BAP) unicast server
functionality. This allows a device to act as the
unicast server role, which can accept unicast streams
initiated by a unicast client.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Pointer to int was passed to a function which expected pointer to
uint8_t. There was an unexpected content for big endian as the
highest byte was read instead of the lowest which contained valid char.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Fixed a dependency from printk.h to logging headers which in
certain configurations could lead to circular dependencies.
Cleaned up printk.c to call z_log_vprintk from vprintk.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Flushing logs here is especially vital if LOG_PRINTK is enabled.
In that case printk goes to log and without flushing after all
tests are run you will not get the final report out.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Add implementation to limit Extended Scanned data to a
configurable maximum length when generating HCI reports.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When hashing attributes for the UUID cases:
BT_UUID_GATT_PRIMARY_VAL
BT_UUID_GATT_SECONDARY_VAL
BT_UUID_GATT_INCLUDE_VAL
BT_UUID_GATT_CHRC_VAL
BT_UUID_GATT_CEP_VAL
where (handle || UUID || value) is to be hashed, the worst case size of
attribute value can be deduced from the associated union that describes
all the attribute values in the given cases.
Update the data array to accommodate for the worst case size.
Fixes#39131
Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
If HCI packet length is greater than endpoint MPS or currently
received data block (over USB), next block could be larger
than allocated net_buf buffer.
Check buffer tailroom before copying data using net_buf_add_mem().
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Function bt_buf_get_tx(), which is used to allocate buffer from
fixed-size pool, does not check size argument before copying
the data with the length size into fixed-size buffer, wich may
not be large enough.
Check immediately before copying if the tailroom of the buffer
is large enough.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
In a similar way as its done for IPv6. This allows to rejoin the group
once the interface is up again.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
CONFIG_OPENOCD_SUPPORT was deprecated in favor of
CONFIG_DEBUG_THREAD_INFO in Zephyr v2.6.0 and can now be removed.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
Conceptually the net_mgmt_lock should be a mutex instead of a
semaphore. It is easier to identify the owner of a mutex and
debug when deadlock happens, so convert it.
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
For tracing_user, the sys_trace_isr_enter() & sys_trace_isr_exit()
block any nest interrupts & most SMP interrupts for the user. It is
hard to analyze the IRQ preemption(e.g., each IRQ counter and execution
time). This commit adds ISR nest level for each CPU to the user instead
of blocking user call back when nest interrupts.
Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
The commit fixes bug in compile time calculation of file download
chunk, FS_MGMT_DL_CHUNK_SIZE, that is permitted within selected
mcumgr buffer size, where the mcumgr header length has not been
taken into account.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit removes internal names given to Kconfig options,
in img_mgmt_config.h, and modifies code to use the Kconfig options
directly.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit removes internal names given to Kconfig options,
in fs_mgmt_config.h, and modifies code to use the Kconfig options
directly.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Set `body_start` pointer regardless of the body position in the recv
buffer. In result, the pointer shall indicate correctly position of the
body for each fragment, it's also explicit now that if the pointer is
not set for a fragment, there's no body in that particular fragment.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Validate the respective attribute parameters only if both are provided
at given level. This prevents from comparing for instance unset pmax
value (equal to 0) with some new pmin value sent by the server.
Additionally, fix the sanity check for the `pmax` value set on observer,
after fetching the attribute value at all levels (including the default
value at from the server object). Instead of using wrong max(pmin, pmax)
formula, set the pmax value only if it's a valid one (>= pmin),
otherwise ignore the value and set it to 0. This makes the notification
engine ignore the pmax value set for observation.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The CP bit is read in DF connected mode while interpreting
LL_CTE_RSP PDU, hence it must be available in struct pdu_data
type.
There were missing two Kconfig options in new LLCP tests.
They were reponsbile for disable of CP bit instruct pdu_data.
That caused tests to fail during compilation.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>