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>
Remove the wifi_mgmt interface overriding default values with values
from kconfig. The defaults were only applied when a `params` struct was
provided by the application.
This is the case when the application is explicitly setting the options
it wants, why is the mgmt API changing these. When `params` is NULL and
thus modem defaults are requested, these defaults aren't applied. This
is the opposite behaviour from what seems reasonable.
In addition, these options are:
* Undocumented
* Using non-trivial string parsing functions (strtok)
* Adding complexity to the API implementation by forcing support for
ROM versions of command line arguments.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
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>
There was a new Kconfig for USB-C init priority that is conflicting
with currently used Kconfig for init of VBUS and TCPC.
This commit changes the names to more specific related to the subsystem
they belong to.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
This commits adds support for the SO_REUSEPORT socket option.
The implementation follows the behavior of BSD and tries to also follow
the specific additional features of linux with the following
limitations:
* SO_REUSEADDR and SO_REUSEPORT are not "the same" for client sockets,
as we do not have a trivial way so identify a socket as "client"
during binding. To get the Linux behavior, one has to use SO_REUSEPORT
with Zephyr
* No prevention of "port hijacking"
* No support for the load balancing stuff for incoming
packets/connections
There is also a new Kconfig option to control this feature, which is
enabled by default if TCP or UDP is enabled.
Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
This commit adds support for the SO_REUSEADDR option to be enabled for
a socket using setsockopt(). With this option, it is possible to bind
multiple sockets to the same local IP address / port combination, when
one of the IP address is unspecified (ANY_ADDR).
The implementation strictly follows the BSD implementation and tries to
follow the Linux implementation as close as possible. However, there is
one limitation: for client sockets, the Linux implementation of
SO_REUSEADDR behaves exactly like the one for SO_REUSEPORT and enables
multiple sockets to have exactly the same specific IP address / port
combination. This behavior is not possible with this implementation, as
there is no trivial way to identify a socket to be a client socket
during the bind() call. For this behavior, one has to use the
SO_REUSEPORT option in Zephyr.
There is also a new Kconfig to control this feature similar to other
socket options: CONFIG_NET_CONTEXT_REUSEADDR. This option is enabled by
default if TCP or UDP are enabled. However, it can still be disabled
explicitly.
Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
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>
While matching source address for a given Link-Local destination the
functions iterate over interfaces and return a first result with a
valid LL-address. However, they should first try to fetch address of
the default interface as it not always the first one on the list.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
Allow Bootstrap server to close the DTLS connection immediately
after receiving Ack to Bootstrap-Finish command.
This is not an error as either parties are allowed to tear down
the connection.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Allow certain RD-client states to timeout.
As stated in LwM2M specification:
The bootstrap procedure failed when the LwM2M Client did not
receive the "Bootstrap-Finish" operation after the
EXCHANGE_LIFETIME time period expired.
The EXCHANGE_LIFETIME parameter is defined in RFC 7252
We must handle the case where Bootstrap server is not sending
information towards us.
Signed-off-by: Seppo Takalo <seppo.takalo@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>
When publish buffer run out, no thread active process work.
Fix this, by reschedule process work.
Signed-off-by: Weiwei Guo <guoweiwei@syriusrobotics.com>
Current MQTT-SN topic and publish allocators are not thread safe.
Fix this, by using k_mem_slab instead of arrays.
Signed-off-by: Weiwei Guo <guoweiwei@syriusrobotics.com>
Releasing the lock before notifying condvar led to a race condition
between a thread calling k_condvar_wait to wait for a condition variable
and another thread signalling for this same condition variable. This
resulted in the waiting thread to stay pending and the handle to it
getting removed from the notifyq, meaning it couldn't get woken up
again.
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
When a packet can't be cloned we crash as we try to initialize the
cursor on a nullptr. We should check if we have a valid pointer,
and if we don't we drop the packet along with a warning.
Signed-off-by: Andreas Ålgård <aal@ixys.no>
In low memory conditions, its possible for socketpair memory allocation
to fail and then the socketpair is freed but after that the remote
semaphore is released causing a crash.
Fix this by freeing the socketpair after releasing the semaphore. Add a
test case to induce low memory conditions (low HEAP and high socketpair
buffer size), with the fix issue is not seen.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This commit optimizes the performance of the script chats by
storing the size of requests with the chat script chat, negating
the need to use strlen() within the modem_chat module every time
a chat script chat request is sent.
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
This commit adds one new feature, modem_chat_run_script(),
which synchronously runs a script.
The existing function modem_chat_script_run() is async,
and doesn't follow the naming convention created for the
other modem modules, specifically, all functions are sync,
unless appended with _async.
To preserve backwards compatibility, the existing function
modem_chat_script_run() will remain until deprecated. It
simply calls modem_chat_run_script_async().
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
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>
Rather than yielding to idle thread, keep the part awake.
So debugger can still access it,
since some SOCs cannot be debugged in low power states.
Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
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>
All WiFi channel numbers fit within a 8 bit number, as the maximum
allocated channel is 233. This halves the memory requirement.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
The errors are printed in hex, but no prefix was used. This could be
confused with usual errno return values. The 0x prefix makes clear
that it's a hex value.
Also a missing minus sign is added to one log message.
Signed-off-by: Martin Jäger <martin@libre.solar>
NET_STATISTICS_PPP are dependend on NET_L2_PPP, not on NET_PPP.
This allows to use statistics also in modem subsys.
Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
Add check for device busy when CONFIG_PM_NEED_ALL_DEVICES_IDLE is
set to y because one or more devices may still in busy and causes
problem when system go into low power in Intel ISH platform.
Signed-off-by: Leifu Zhao <leifu.zhao@intel.com>
Usage of application level for device drivers needs to be avoided. Also
introduced a new init level, with default to 90 as other dependencies of
USB-C run at priority 80.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
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>
This is the final step in making the `zephyr,memory-attr` property
actually useful.
The problem with the current implementation is that `zephyr,memory-attr`
is an enum type, this is making very difficult to use that to actually
describe the memory capabilities. The solution proposed in this PR is to
use the `zephyr,memory-attr` property as an OR-ed bitmask of memory
attributes.
With the change proposed in this PR it is possible in the DeviceTree to
mark the memory regions with a bitmask of attributes by using the
`zephyr,memory-attr` property. This property and the related memory
region can then be retrieved at run-time by leveraging a provided helper
library or the usual DT helpers.
The set of general attributes that can be specified in the property are
defined and explained in
`include/zephyr/dt-bindings/memory-attr/memory-attr.h` (the list can be
extended when needed).
For example, to mark a memory region in the DeviceTree as volatile,
non-cacheable, out-of-order:
mem: memory@10000000 {
compatible = "mmio-sram";
reg = <0x10000000 0x1000>;
zephyr,memory-attr = <( DT_MEM_VOLATILE |
DT_MEM_NON_CACHEABLE |
DT_MEM_OOO )>;
};
The `zephyr,memory-attr` property can also be used to set
architecture-specific custom attributes that can be interpreted at run
time. This is leveraged, among other things, to create MPU regions out
of DeviceTree defined memory regions on ARM, for example:
mem: memory@10000000 {
compatible = "mmio-sram";
reg = <0x10000000 0x1000>;
zephyr,memory-region = "NOCACHE_REGION";
zephyr,memory-attr = <( DT_ARM_MPU(ATTR_MPU_RAM_NOCACHE) )>;
};
See `include/zephyr/dt-bindings/memory-attr/memory-attr-mpu.h` to see
how an architecture can define its own special memory attributes (in
this case ARM MPU).
The property can also be used to set custom software-specific
attributes. For example we can think of marking a memory region as
available to be used for memory allocation (not yet implemented):
mem: memory@10000000 {
compatible = "mmio-sram";
reg = <0x10000000 0x1000>;
zephyr,memory-attr = <( DT_MEM_NON_CACHEABLE |
DT_MEM_SW_ALLOCATABLE )>;
};
Or maybe we can leverage the property to specify some alignment
requirements for the region:
mem: memory@10000000 {
compatible = "mmio-sram";
reg = <0x10000000 0x1000>;
zephyr,memory-attr = <( DT_MEM_CACHEABLE |
DT_MEM_SW_ALIGN(32) )>;
};
The conventional and recommended way to deal and manage with memory
regions marked with attributes is by using the provided `mem-attr`
helper library by enabling `CONFIG_MEM_ATTR` (or by using the usual DT
helpers).
When this option is enabled the list of memory regions and their
attributes are compiled in a user-accessible array and a set of
functions is made available that can be used to query, probe and act on
regions and attributes, see `include/zephyr/mem_mgmt/mem_attr.h`
Note that the `zephyr,memory-attr` property is only a descriptive
property of the capabilities of the associated memory region, but it
does not result in any actual setting for the memory to be set. The
user, code or subsystem willing to use this information to do some work
(for example creating an MPU region out of the property) must use either
the provided `mem-attr` library or the usual DeviceTree helpers to
perform the required work / setting.
Signed-off-by: Carlo Caione <ccaione@baylibre.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>
Reduce the max timeout for shell to 1 second.
Change the sip_svc open shell function to take millisecond as timeout
argument.
Signed-off-by: Mahesh Rao <mahesh.rao@intel.com>
This PR makes the modem_pipe instances track if they have
data ready to receive, and invoke the RECEIVE_READY event
every time they are attached if the backend implementing
the pipe has notified that receive is ready.
This mechanism ensures that modules attaching to a pipe
get the async RECEIVE_READY event immediately after
attaching to a pipe if there is data ready, instead of
having to poll the pipe, or worse, wait until newer data
becomes available.
The addition revealed a timing issue in the cmux test
suite. Specifically the CMUX instance now immediately
receives the response to a command which the CMUX
instance has not sent yet, causing it to drop the
response.
The CMUX test suite now uses the transaction
mechanism of the mock_pipe to wait for the command
before sending the response.
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
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>
ISO-TP CAN-FD support can be enabled at runtime.
Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
Signed-off-by: Martin Jäger <martin@libre.solar>
SWO reference frequency was set based on `swo-ref-frequency` under `itm`
nodelabel or `/cpus/cpu@0/clock-frequency` property. Not all platforms
configure those.
All ST devices configure CPU frequency in `clock-frequency` under `rcc`
nodelabel. Configuring the same value for each board in
`/cpus/cpu@0/clock-frequency` would be one way to make SWO work out of the
box. There is lots of copy-pasting involved in this, which makes this very
error-prone.
Introduce Kconfig option, which will default to values configured in `itm`
or `/cpus/cpu@0`. The main advantage will be for platforms like ST, where
CPU clock frequency is already configured in another place. Thsoe could
override default value in SoC, board or any other platform specific layer.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
The current implementation uses both, host and card capabilites to derive
the maximum bus width to be used. However, in cases where a MMC device is
not connected to the host via shdc using the full bus width of 8 lines,
device initialization fails. Introducing the `bus-width` property
circumvents this by reducing the host bus capabilites and forcing
communication with the MMC device using 1, 4 or 8 lines.
Signed-off-by: Mourad Kharrazi <mourad.kharrazi@ithinx.io>
This change brings in support for setting various Wi-Fi modes and
enables a specific Wi-Fi interface to be also placed into a sniffer
operation via monitor mode and promiscuous mode. A raw TX- packet
Injection mode is also introduced
Signed-off-by: Vivekananda Uppunda <vivekananda.uppunda@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>
This adds support to allow any priority from the user instead of
limiting to the protocol values (0-7). This is useful in conveying
custom priorities from application to the driver/chipset.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This is handy in testing of setting priority directly rather than
deriving from DSCP. Please note ICMP doesn't use net context.
This is applicable for both shell and API.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This is a private kernel header with private kernel APIs, it should not
be exposed in the public zephyr include directory.
Once sample remains to be fixed (metairq_dispatch), which currently uses
private APIs from that header, it should not be the case.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit adds the DFM (DevAlert target side code) module and
moves the TraceRecorder module into the percepio module, which
results in the TraceRecorder module definition being removed
from the west manufest and module definition within zephyr.
Signed-off-by: Aron Lander <aron.lander@percepio.com>
This commit adds support for partial matches for the modem_chat
module. A match is a combination of an expected response to a
request along with delimiters to use and a handler for the
parsed response.
The usual behavior of the modem_chat script is to continue to
the next step when any expected response is received. The partial
flag indicates that the script should not proceed to the next
step if the response matches the match. This is useful for
commands which respond with an unspecified number of lines,
followed by an "OK". This flag allows the script to essentially
run in a "while" loop until OK is received.
Along with this addition, a more scalable macro for initializing
the modem_chat match struct, MODEM_CHAT_MATCH_INITIALIZER().
Without this macro, we will need 4 different macros to initialize
the 4 variants of a chat_match, and 8 when the next feature is
added...
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
The ICMSG backend now has a dedicated workqueue to process incoming IPC
messages. The system workqueue is no longer utilized for that purpose.
Testing shows that in certain scenarios substituting a RPMsg backend
with ICMsg results in deadlocks.
The deadlocks were a symptom of running a synchronous RPC protocol from
the context of the system workqueue and transpired as follows:
1. The RPC protocol sends a request over the ICMsg backend on the system
workqueue thread.
2. The RPC protocol puts the thread to sleep until response is received.
This puts the system workqueue thread to sleep.
3. The response to the request arrives over ICMsg backend.
4. The backend signals a work item to the system workqueue.
5. The system workqueue is unable to process the response due to being
previously pended on the RPC request.
The deadlock was initially observed with the nrf-802154 driver in
conjuntion with the IPv6 stack.
To prevent this condition from occurring, the approach was selected to
give ICMsg a dedicated workqueue thread.
Added a Kconfig option that enables the dedicated workqueue by default.
The config can be disabled, if the user wants to preserve RAM capacity
and is certain that the deadlock condition is not encountered.
Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
wifi_utils_parse_scan_ssids could cause a crash if a constant string is
passed to it. Fix this by duplicating the input string parameter before
parsing it with strtok_r.
Also limit the range of the CONFIG_WIFI_SCAN_SSID_FILT_MAX parameter
from 1 to 4 to avoid stack overflow due to users specifying a large
value for this parameter.
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
wifi_utils_parse_scan_bands could cause a crash if a constant string is
passed to it. Fix this by duplicating the input string parameter before
parsing it with strtok_r.
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@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>
This commit delegates the modem_pipe_notify_closed() call
resulting from the UART async API UART_RX_DISABLED event
to the workqueue. This is neccesary as the async UART
callback may be called from ISR context.
modem_pipe_notify_closed() must be called from outside of
the ISR context as it takes a mutex.
The commit also adds a missing break to the async UART
callback, and adds a missing dependency to the Kconfig
for the UART backends, RING_BUFFER=y
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
The variables are usually placed into an output region located in FLASH
memory when linking, but the variables are not marked `const`, so the
section ends up with `W` writeable section flag:
```bash
❯ arm-zephyr-eabi-readelf --section-headers build/zephyr/zephyr.elf | \
grep -E '(Section Headers:)|( \[Nr\])|(zephyr_dbg_info)'
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[10] zephyr_dbg_info PROGBITS 60012298 01238c 000040 00 WA 0 0 4
```
Set them as const to set the output section to read-only:
```bash
❯ arm-zephyr-eabi-readelf --section-headers build/zephyr/zephyr.elf | \
grep -E '(Section Headers:)|( \[Nr\])|(zephyr_dbg_info)'
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[10] zephyr_dbg_info PROGBITS 60012298 01238c 000040 00 A 0 0 4
```
Signed-off-by: Noah Pendleton <noah.pendleton@gmail.com>
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>
Add a network configuration option to configure whether IEEE 802.15.4
packets are expected to be ACKed or not.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
In the IEEE 802.15.4 area certain settings must be set before
net_if_up() may be called (e.g. the channel).
Also net_if_up() may not be called if
CONFIG_IEEE802154_NET_IF_NO_AUTO_START=y.
This fixes the set-up order and handling of
CONFIG_IEEE802154_NET_IF_NO_AUTO_START.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
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>
Use the HAL event clear function to clear the RTC EVENT
instead of accessing the register directly.
This allows using an updated version of the RTC HW models
which generate level interrupts (as the real HW) and in
which if the EVEN register is not properly cleared,
the interrupts are kept high, resulting in the interrupt
handler reentering immediately after exiting.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The command was missing a metalen check, and attempted
to access array of size 0, which could give a build
warning.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adds support for composition data page 2 & 130.
In this implementation the responsibillity for filling the page 2
buffer is left to the application through the new comp page 2 cb API.
Only the application can know/decide if the device is NLC compliant,
and must thus be given the responsibillity for cheking the NLC profile
requirements, defined in the NLC specs, and filling the response buffer
for comp data page 2.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
If the central disconnects a CIS while it is being
established, then we receive both a CIS established event
with BT_HCI_ERR_OP_CANCELLED_BY_HOST and a disconnect complete
event.
In this case we should not call bt_iso_disconnected in the
CIS established event handler, as that will also be
called from the disconnect complete event handler.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
As per the core spec, the CIS is not allowed to disconnect
a CIS if it is pending (i.e. in the connecting state).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
So far only object tracing/tracking could be individually disabled (e.g.
CONFIG_TRACING_SEMAPHORE=n). Now tracing of any API may be disabled
(e.g. CONFIG_TRACING_PM=n).
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The CIS Central uses the algorithm described in BT Core 5.4 Vol 6,
Part G, Section 2.2 to calculate the Max_PDU value for framed mode.
However, HAP needs the Max_PDU to be calculated according to "Core
enhancement for ISOAL CR" coming with the "Atlanta" update. With this
update, the fragmentation is controlled via a parameter at CIG creation.
Enabling CONFIG_BT_CTLR_CONN_ISO_AVOID_SEGMENTATION will set the
ISO_Interval to 7.5 ms for a 10 ms framed CIG, and calculate Max_PDU to
45/65 for 16/24 kHz.
Signed-off-by: Morten Priess <mtpr@oticon.com>
In case RST packet is received or malformed packet is received, the TCP
should not proceed with the state machine execution (which may process
the invalid packet) but rather jump directly to exit, where the
connection will be closed.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The net_mgmt subsystem offers a function which waits (blocks)
until a specified net event occurs. An event callback is
pushed to the stack, then added to the net_mgmt_event_callback
list. If the event occurs, the net_mgmt thread calls the
callback and deletes the callback from the list. However, if
the event does not occur within the timeout specified when
invoking mgmt_event_wait_call() the function will return,
corrupting the callback structure the stack is reused.
This PR fixes the issue by deleting the callback before exiting
in case the event does not occur.
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
The previous design with dedicated bits in the structure required a
user to explicitly set each bit.
Using one flags variable allows to extend the features more easily
in the future and avoids breaking existing code.
This change is particularly useful for the FDF and BRS flags required
for CAN-FD support.
See also previous similar change for the CAN driver in
f8a88cdb27
Signed-off-by: Martin Jäger <martin@libre.solar>
CAP requires setting the streaming context in the metadata,
which requires 4 octets of metadata, so the metadata for
CAP must be greater than or equal to 4.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In default_get_timestamp(), sys_clock_tick_get() is returned when
CONFIG_LOG_TIMESTAMP_64BIT=y. The timestamp frequency should reflect this.
Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
According to the mesh 1.1 spec, section 4.4.14.1: “. The access layer
security on the On-Demand Private Proxy Client model shall use the
device key of the node supporting the On-Demand Private Proxy
Server model.“
This commit alters the API and implementation to reflect this.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
The backend currently returns the pipe closed event immediately
after calling uart_rx_disable() which is not the correct behavior.
the pipe closed event should be called when the UART_RX_DISABLED
event is raised by the UART driver.
With this fix, back-to-back open/close/open... will work as
expected, where before the second open would often fail since
the UART was not actually disabled yet.
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
Remove ifdef around `srcs` and let linker exclude it when Opcode
Aggregator Client model is not enabled.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
If the bonding information has been cleared before pairing had a chance
to complete (probably by the application), indicate this by setting an
appropriate log message.
Also check that keys exist before calling `bt_keys_store`.
Fixes#59788 and #61465
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
This fixes bt_audio_codec_cfg_get_chan_allocation_val return value that
shall be 0 in case of success.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This fixes data pointer that was never set because wrong pointer
assignment.
It's regression introduced in:
b4af917ad0
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Use NRF_CCM HEADERMASK register to use correct Additional
Authentication Data (AAD) from ISO PDU header.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix an issue in the CCC configuration when the Peripheral device
maintains two or more distinct connections on different identities
with the same peer. The issue occurs when the local device performs
the pairing and the bonding procedure on a connection associated
with one of the Bluetooth identities. During the identity resolution,
the peer address field in the CCC descriptor is converted from the
RPA-type address to the Identity Address. However, the destination
address on the remaining connection objects associated with other
Bluetooth identities is not converted. Due to this, their CCC
configuration is reset and GATT indications and notification fail
to be sent even if the Central device subscribed to them.
Added necessary code to iterate over all connection objects during
the identity resolution phase and aligned their destination address
from the RPA-type to the Identity Address.
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
Fix timestamp calculation to use CIS reference anchor point
instead of incorrectly used CIG reference anchor point.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
NVS lookup cache currently uses CRC8/16 as a hash function
to determine the cache position, which is not ideal choice.
For example, when NVS lookup cache size is 512 and 256
subsequent NVS IDs are written (that is, 0, 1.., 255), this
results in 128 cache collisions.
It is better to use a dedicated integer hash function. This
PR uses one of the 16-bit integer hash functions discovered
with https://github.com/skeeto/hash-prospector project. The
hash function was additionally tested in the context of NVS
lookup cache using simple NVS ID allocation patterns as well
as using real device NVS dump.
Also, add a test case to verify that the hash function is
not extremely bad.
Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
Add TI VIM (Vectored Interrupt Manager) interrupt controller support.
VIM is a TI specific custom interrupt controller for ARM cores.
In J721E soc, VIM aggregates interrupts to Cortex R5 cores.
TRM for J721e https://www.ti.com/lit/zip/spruil1
File: spruil1c.pdf
VIM: section 6.3.3.6
Signed-off-by: Prashanth S <slpp95prashanth@yahoo.com>
Modify the signature of the k_mem_slab_free() function with a new one,
replacing the old void **mem with void *mem as a parameter.
The following function:
void k_mem_slab_free(struct k_mem_slab *slab, void **mem);
has the wrong signature. mem is only used as a regular pointer, so there
is no need to use a double-pointer. The correct signature should be:
void k_mem_slab_free(struct k_mem_slab *slab, void *mem);
The issue with the current signature, although functional, is that it is
extremely confusing. I myself, a veteran Zephyr developer, was confused
by this parameter when looking at it recently.
All in-tree uses of the function have been adapted.
Fixes#61888.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Modify when the BT_BAP_EP_STATE_ENABLING state is set during
bt_bap_broadcast_source_start.
The reason why the state is now set before the call to
bt_iso_big_create, is to handle the case where the BIG
created event actually happens and is handled (by another
thread) faster than the state change is done, which could
cause an invalid state check if the streaming state is
attempted to be set before the enabling state.
Since the events from the controller may be handled by a
different thread, we should not assume that this function returns
before the event is handled.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The application gets notified about both valid and invalid data.
As data arrives every SDU interval, we would like to only print the
valid data to avoid the shell being flooded with logs.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
For flash device, littlefs should be located at the partition.
Current implementation of the fs shell is hardcoded for the flash device
and the compilation fails if STORAGE_PARTITION isn't defined in the
device tree.
Add options for block dev support. This allows to mount littlefs on the
block device from the shell, and also removes the compile time
dependency on STORAGE_PARTITION, if CONFIG_FS_LITTLEFS_BLK_DEV is set.
Fix mounting of littlefs blk device. lfs_mount stucks in case when the
read/prog buffer less than SDMMC block size, because it can cause memory
corrupt, for example, look into function 'card_read_blocks' how it writes
data to read buffer in case when buffer isn't aligned. With default
config we have 32 bytes in the read buffer but trying to write
'block_size' to it and get memory corrupt, the same issue will be in
case when the read buffer is aligned.
This is an incremental improvement, ideally, someone should implement
selection of the storage dev from the shell args.
Co-authored-by: Mykola Kvach <mykola_kvach@epam.com>
Signed-off-by: Dmytro Semenets <dmytro_semenets@epam.com>
This utility header was accessing directly the interrupt
controller HW models, but those are not an interface one
can expect to not change, or to be avaliable in different
targets.
Instead we change it to use the APIs we have a contract
about, that is, the ones all POSIX arch boards are
expected to provide.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Rename BT_AUDIO_CODEC_QOS_[UN]FRAMED to
BT_AUDIO_CODEC_QOS_FRAMING_[UN]FRAMED and give a name
to the enum, which is then used by the
struct bt_audio_codec_qos.
The rename was needed as we had a codec_qos initializer of the
same name, so the values were renamed to avoid duplicated
macro names.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If network interface name support is enabled, print the name
when showing network interface data.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Make sure we use the network interface name (if configured)
instead of device name when binding to certain network
interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If CONFIG_NET_INTERFACE_NAME is enabled (default is y), then
system will automatically set a user friendly name to the network
interface like eth0, wlan0 etc.
Application can change the interface name if needed.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Fix few mismatched CONTAINER_OF, few missing pointers to the first
element, one explicit casting.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Add option to prefix log message with thread ID or thread name.
Align tests and add test case to the log_output test.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Add Kconfig LOG_THREAD_ID_PREFIX option which allows storing
thread id in the log message and process it as message prefix
(as id or thread name).
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Fix incorrect use of Max_SDU_Size and SDU_Interval parameters in
ISO Transmit Test Mode code.
Fixes EBQ test LL/CIS/PER/BV-08-C.
Signed-off-by: Morten Priess <mtpr@oticon.com>
This changes bt_audio_codec_cfg_get_val function to return the data
length found. Otherwise, this function gives no information about the
returned data length.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Fix few mismatched CONTAINER_OF, one missing k_work_delayable_from_work
and few that should be pointing at the first elemnet.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
The twt and ps helper functions were not namespaced (were missing
wifi_ prefix).
Also change wifi_get_twt_... to more logical wifi_twt_get...
like the other twt prefixed functions and wifi_get_ps... to
wifi_ps_get... like the other ps prefixed functions.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Clean up sizes of some SD data fields, as the max value of these fields
is limited by the SD specification
Specifically, the limits are as follows:
num_io: 0-7, 3 bits (SDIO only)
relative_addr: 16 bits (SDMMC/MMC)
block_size: 12 bits (Max of 2KB, uint16_t used)
sd_version: 8 bits (currently at version 3)
card_speed: 8 bits (could potentially be reduced in size)
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Makes img_mgmt_slot_to_image image number independent and moves
it to header file as static inline.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The erase logic has been switched to using img_mgmt_get_opposite_slot
and the img_mgmt_get_other_slot has been removed.
The commit adds CONFIG_MCUMGR_GRP_IMG_ALLOW_ERASE_PENDING Kconfig
options, default set to n, that allows to make pending slot
erasable. The option only allows erase on pending slot that
is not revert slot.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Make img_mgmt_active_slot independent from
CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER for MCUboot swap type
algorithms.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit modifies image list command operations to use
img_mgmt_get_next_boot_slot instead of directly relying of
MCUboot flags.
The function is now used, also, by img_mgmt_slot_in_use to
figure out whether queried slot is in use.
The commit introduces two new Kconfig options
MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_IMAGE_SECONDARY
MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_IMAGE_ANY
that allow users to enable confirming non-active images slots.
The MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_IMAGE_SECONDARY is y
by default to keep original behavior of logic that accidentally
allowed confirming secondary slot.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit adds functions:
img_mgmt_get_next_boot_slot
img_mgmt_get_opposite_slot
to simplify obtaining information on next boot slot.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Added optional support for read ISO link quality command.
Added link quality member in struct ll_iso_stream_hdr.
Signed-off-by: Mads Winther-Jensen <mdwt@demant.com>
If there are duplicate handles the Controller shall return the
error code Invalid HCI Command Parameters (0x12)
Fixes a failure in the EBQ test LE/AdvExt/Req-01 (part of the Ellisys
quality test suite)
Signed-off-by: Troels Nilsson <trnn@demant.com>
currently when no enough memory is found a (1 << (-1)) value is returned
instead of 0.
Fix this by returning 0 and simplify log2 computation
Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
Fixes some incorrect assertions in ull_adv.c on connection establishment
Note that the usual checks using adv->lll.conn doesn't work here,
since ull_periph_setup() NULLs the lll's conn structure pointer
before stopping the ticker
Signed-off-by: Troels Nilsson <trnn@demant.com>
This PR adds the following modem modules to the subsys/modem
folder:
- chat: Light implementation of the Linux chat program, used to
send and receive text based commands statically created
scripts.
- cmux: Implementation of the CMUX protocol
- pipe: Thread-safe async data-in/data-out binding layer between
modem modules.
- ppp: Implementation of the PPP protocol, binding the Zephyr PPP
L2 stack with the data-in/data-out pipe.
These modules use the abstract pipes to communicate between each
other. To bind them with the hardware, the following backends
are provided:
- TTY: modem pipe <-> POSIX TTY file
- UART: modem pipe <-> UART, async and ISR APIs supported
The backends are used to abstract away the physical layer, UART,
TTY, IPC, I2C, SPI etc, to a modem modules friendly pipe.
Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
Ensure card CSD and CID variables are initialized in sd_ops functions
for reading card CSD and CID data.
Fixes#59562
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Add TLS_DTLS_CID socket option, which enables to use the Connection ID
extension for the DTLS session.
The option provides control of the use of CID with the `setsockopt()`
function. The value provided can disable, enable, and control whether to
provide a CID to the peer. It uses a random self CID (if told to provide
one to the peer) unless TLS_DTLS_CID_VALUE set previously.
Add TLS_DTLS_CID_VALUE to get or set the CID sent to the peer, if any.
Add TLS_DTLS_PEER_CID_VALUE to get the CID value provided by the peer,
if any.
Add TLS_DTLS_CID_STATUS to determine if CID used, and whether
bidirectional or one way.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Signed-off-by: Pete Skeggs <peter.skeggs@nordicsemi.no>
bt_l2cap_chan_send_sdu previously returned the number of bytes sent
in the last sent sdu buf fragment or 0 if the buf has only
one fragment. bt_l2cap_chan_send_sdu now returns the total data
bytes sent from the buf.
Signed-off-by: Tom Finet <tom.codeninja@gmail.com>
Fix a bunch of mismatched CONTAINER_OF, few missing
k_work_delayable_from_work conversions but also many
bt_l2cap_le_chan/bt_l2cap_chan and few others.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
rp_enc_state_wait_ltk_reply() is executed in thread context, so
it is not allowed to move the encryption state machine forward.
Defer LTK reply handling to next prepare event by introducing a continue
state.
Update the unit test to reflect this, and remove the TODO that actually
said there was an issue in the first place.
Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
Fix few mismatched CONTAINER_OF, few missing k_work_delayable_from_work
and a missing reference to the array first element.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Prevent compiler optimizations from changing the order of assignments in
the ticker API transactions. This could cause lost operation requests
and unexpected behavior under certain race conditions.
Signed-off-by: Morten Priess <mtpr@oticon.com>
There were a few issues in the way that PACS handled notifying:
1) A couple of dangling pointers (fixed by declaring some
`static const struct bt_uuid`
2) Some wrong Kconfig guards were used
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The use of private APIs z_add_timeout() and friends is not recommended.
With this commit, usual kernel timer APIs are used.
Fixes#61738
Signed-off-by: Martin Jäger <martin@libre.solar>
The connectivity monitoring subfeature of conn_mgr is currently also
named conn_mgr, which is confusing.
This commit renames it to conn_mgr_monitor, or conn_mgr_mon for short,
for clarity.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Add a helper allowing connectivity implementations to more easily access
connectivity flags on connectivity bindings.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Adds conn_mgr_binding_lock/conn_mgr_binding_unlock, which connectivity
implementations can call to lock or unlock the passed in connectivity
binding.
This allows connectivity implementations to safely make direct accesses
to binding data from outside conn_mgr_conn_api callbacks, and should
allow cleaner, more robust connectivity implementations to be written.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Splits many definitions from conn_mgr_connectivity.h off into their own
header, conn_mgr_connectivity_impl.h
conn_mgr_connectivity.h now focuses solely on user/application-facing
APIs, and conn_mgr_connectivity_impl now contains all functions, utils,
definitions intended for use by connectivity implementations, including
conn_mgr_if_get_binding, which is now available for use by connectivity
implementations.
This lays the foundation for allowing connectivity implementations
easier and safer access to their internal state through internal APIs.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Adds a target RPA known unknown cache; it fulfills a similar function
to the existing peer RPA cache, used for scanning of directed
advertisements
Signed-off-by: Troels Nilsson <trnn@demant.com>
According to mesh 1.1 spec (4.4.1.2.2 Composition Data state):
“If the complete list of models does not fit in the Data field, the
element shall not be reported.“
The implementation of bt_mesh_comp_data_get_page_1 does
not consider this, and further it will assert the device if the passed
buffer is to small.
This commit adds a check that prevents populating passed buffer
if the full element entry wont fit in the buffer.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Remove the qos field from
bt_cap_unicast_audio_start_stream_param as it was not used.
The QOS values are set when creating the unicast group,
and not when starting the streams.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
ZBus stores observers in two ways: statically using a list and dynamically
using a memory slab. Both present limitations. Static observers work only
for channel definition. The dynamic observers rely on a memory slab that
forces the user to manage its size to avoid issues with adding
observers. This commit fixes the static allocation problem by using the
iterable sections for allocating observation data and replacing the VDED
execution sequence since now it is possible to prioritize static observer
execution. All the runtime observers are dynamically allocated on the heap
instead of a specific memory pool.
BREAK changes (only internal, not APIs):
* ZBus channel metadata changed. Remove the observers' static array
pointer. Rename the `runtime_observers` pointer to `observers`. Add
`observer_start_idx` and `observer_end_idx`;
* Change the VDED execution sequence. The position (on definition time),
the priority in conjunction with the lexical order, is considered for
static post-definition time observers. At last, the runtime observer
follows the adding sequence;
* Replace the `CONFIG_ZBUS_RUNTIME_OBSERVERS_POOL_SIZE` with
`CONFIG_ZBUS_RUNTIME_OBSERVERS`.
New APIs:
* New iterable section iterators (for channels and observers) can now
receive a user_data pointer to keep context between the function calls;
* New `ZBUS_LISTENER_DEFINE_WITH_ENABLE(_name, _cb, _enable)` and
`ZBUS_SUBSCRIBER_DEFINE_WITH_ENABLE(_name, _queue_size, enable)` that
enable developers define disabled observers. They need to be enabled
during runtime to receive notifications from the bus;
* `ZBUS_CHAN_ADD_OBS` macro for adding post-definition static observers of
a channel.
Important changes:
* Move the ZBus LD file content to the `common-ram.ld` LD file. That was
necessary to make ZBus compatible with some Xtensa and RISCV boards.
Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
Drop few redeclared variables, fixes some:
settings_mgmt.c:454:30: error: declaration of ok shadows a previous
local [-Werror=shadow]
454 | bool ok;
| ^~
settings_mgmt.c:436:14: note: shadowed declaration is here
436 | bool ok = true;
| ^~
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Refactor the bt_audio_codec_cfg to use flat arrays to store
metadata and codec specific configurations.
The purpose of this is to make it easier to copy the data
between layers, but also to support non-LTV data for non-LC3
codec configurations.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added a BSIM tests for PACS notification functionality. This test
tests that all optional notifies are working, as well as verifying
that a disconnected subscribed client will be notified on reconnect.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
This fix allows PACS to notify bonded clients, that were disconnected
when a characteristic with notify property was changed, are being
reconnected.
This fix also implements a defer work so to not block the bt rx
thread during auth callbacks. All other notify calls are for
consistency and style also moved to use the defer work.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
Added Kconfig options to make the various PACS characteristics that are
optionally notifiable selectable as notifiable. Selecting a
characteristic as notifiable will make it so for all pacs instance on
the device.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
Add a a new source coverage for native builds
and new kconfig choice of COVERAGE mode to select which:
* COVERAGE_NATIVE_GCOV: what we had until now with native builds
* COVERAGE_NATIVE_SOURCE: a new LLVM source coverage mode
* COVERAGE_GCOV: the old COVERAGE_GCOV (embedded gcov data generation).
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Fix few instances of delayable work handlers using the k_work pointer
directly in a CONTAINER_OF pointing to a k_work_delayable.
This is harmless since the k_work is the first element in
k_work_delayable, but using k_work_delayable_from_work is the right way
of handling it.
Change a couple of explicit CONTAINER_OF doing the same work as the
macro in the process.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This change allows to register additional handlers for ICMPv6 so the
user can handle some of the messages between they are handled by the
ICMPv6 module in Zephyr by returning NET_CONTINUE.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
There was a corner case which was not handled well in a scenario, when
listening socket was closed during an active handshake with a new
client.
When a listening socket is closed, the accept callback is cleared on the
TCP context. If this happened during a handshake with a new client, i.
e. before final ACK from the client was processed, this lead to a
context leak, as application did not take ownership of the connection
(i. e. had no means to close it).
Fix this, by proactively closing the connection at the TCP level when no
accept_cb is available. Instead of ignoring the fact that no accept_cb
is available, the TCP stack will now enter TCP_FIN_WAIT_1 state and
proceed with a graceful teardown of the connection.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
getsockname() did not work properly on bound sockets, as it verified
whether the socket has an active connection before retuning result. This
is not correct, as socket after bound may not have a connection yet.
Fix this, by verifying that local_addr on an underlying net_context is
set, to determine whether socket has a local address assigned, before
returning result.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This adds SoC and board configs to support the dc233c core
that is available on QEMU. This core has more features than
sample_controller, such as MMU support.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
* Renamed 'coap_client_init_path_options' to
'coap_packet_set_path'
* Moved into 'coap.c'
* The function is public now
Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
Fix options initialization for path and query
when a final segment is one character long.
For example, "a/b" inits path as ["a"] instead
of expected ["a", "b"]. The same applies to
query option. The "a/abc?a&b" options won't
contain "b".
Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
Adds a settings management group to MCUmgr which allows for
manipulation of the zephyr settings from a remote device.
Includes callback hooks to secure access from an application.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
net_iface_status is larger than scan_result, causing
net_iface events to be dropped due to info exceeding
NET_EVENT_INFO_MAX_SIZE.
Signed-off-by: Noah Luskey <LuskeyNoah@gmail.com>
The previous patch to address race condition on STREAM sockets had a
side effect on DGRAM socket, where net_context_recv() is not only
installing recv callback, but also registering a connection at net_conn
level. Doing so before setting remote address first (which is done in
net_context_connect()) had an impact on the connected DGRAM socket
operation, which now accepted packets from any remote peer, and not only
the one socket was connected to.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
ICMPv6 messages with type < 128 are error messages, where we should not
send back another error. The meaning of the code depends on the type.
Signed-off-by: Andreas Müller <andreas.mueller@husqvarnagroup.com>
When resource data length is set to zero, we still need to
ensure that string reading will return an empty string.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Will exclude the code for prefix and checksum functionality if none
of the entries on a device make use of these features, saves ~816
bytes when both features are excluded.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
CONFIG_COVERAGE has been incorrectly used to
change other kconfig options (stack sizes, etc)
code defaults, as well as some samples behaviour,
which should not have dependend on it.
Instead those should have depended on COVERAGE_GCOV,
which, being the one which adds special code and
temporary RAM storage for embedded targets,
require changes to many features.
When building for the native targets, all this was
unnecessary.
=> Fix the dependency.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The CMSIS module glue code was part of arch/ directory. Move it to
modules/cmsis, and provide a single entry point for it: cmsis_core.h.
This entry header will include the right CMSIS header (M or A/R).
To make this change possible, CMSIS module Kconfig/CMake are declared as
external, allowing us to add a new Zephyr include directory.
All files including CMSIS have been updated.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
MCUmgr client upload max data payload length was missing
Transport layer CRC + 16bit lenght. Full net buf packet was
possible to send but receiver side it was blocked because there
was not space for calculate CRC and length.
Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
Retry sending notification was not sent due to e.g. lack of
buffers currently available.
Fixes: #57456
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Retry sending notification was not sent due to e.g.
lack of buffers currently available.
Fixes: #57452
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Changed Add to Enable in help text to convey the intended use of the
Kconfig NET_L2_WIFI_MGMT.
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
Add a scan command option to print the help text for the scan command.
This is to facilitate ease of using the command (since now there are
many different options added to the scan command).
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
Add scan extension to allow limiting the scanning to specific channels.
Only 20 MHz channel specifications are allowed presently.
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
Add scan extension to allow limiting the scan results to a user defined
maximum number. This parameter is intended to return results with the
best RSSI. It cannot be counted upon to limit the scan times since the
Wi-Fi chips might have to scan all the channels to find APs with the
best RSSI values across all channels.
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
Add scan extension to control scanning time spent on channels where
passive scanning is used.
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
Added scan extension to support scanning individual Wi-Fi bands or
combinations thereof.
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
Modify the way the scan type option is passed to the wifi scan command.
This makes it flexible to add more scan options.
Signed-off-by: Sachin D Kulkarni <sachin.kulkarni@nordicsemi.no>
This fixes missing Fix bt_tbs_client_cb.discover call that has been
observed when CONFIG_BT_TBS_CLIENT_CCID was disabled. In such case the
discovery proces was not finished from application point of view,
as the callback was not called.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This removes odd `subscribe` parameter from bt_tbs_client_discover
function parameters list. As the API user enables specific
CONFIG_BT_TBS_CLIENT_* option, the client implementation should
subscribe to the characteristic notifications so that the user receives
the value updates.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
- Fix masking for no coded phy
- Allow ISO_Interval < SDU_Interval for framed mode
- Change BT_HCI_ERR_INSUFFICIENT_RESOURCES to
BT_HCI_ERR_CONN_LIMIT_EXCEEDED.
- Prevent starting same CIS twice
- Cancel an initiated CIS creation procedure if terminated before
sending CIS_IND.
- Implement canceling of local CC procedure. Respond to CIS_RSP with
REJECT, if canceled after CIS_REQ was sent.
- Introduce state CIG_STATE_INITIATING for central, to keep track of
initiating CIS connection, in transition between CONFIGURABLE and
ACTIVE.
Fixes EBQ test /HCI/CIS/BC-03-C.
Signed-off-by: Morten Priess <mtpr@oticon.com>
This fixes the error below:
main.c: In function ‘bt_mesh_provision’:
main.c:173:17: error: ‘node’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
173 | bt_mesh_cdb_node_del(node, true);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>