It was previously assumed that the 'sys_mem_blocks' struct would maintain
information about contiguous blocks allocated so the release API only
took the starting address. This led to an issue where allocating 2+
blocks would end up with a memory leak because any block not being the
first would never be released.
Add the buffer length as an argument so the correct number of blocks can
be released. Also, ammend the tests to match and verify.
Signed-off-by: Yuval Peress <peress@google.com>
The previous RTIO mempool allocation was found to be faulty. Since the
map entries were indexed using the sqe, as soon as the sqe and cqe were
no longer in sync, there was a contention. Effectively a new sqe needing
memory would assume the entry was already consumed by themselves. This
was caused by 'rtio_sqe_rx_buf()' being effectively reentrant (i.e. if
called more than once, it'll return the same buffer). So when the map
entry was marked as allocated it was assumed that it belonged to the sqe
in question and used. This led to the producer writing to memory that
was actively being read by the consumer.
Instead, the sqe's own buf/buf_len fields are used to store the memory.
Once allocated, the memory is stored there and no mapping is needed.
Signed-off-by: Yuval Peress <peress@google.com>
The `SCHED_OTHER` scheduling priority is mandatory as part of
POSIX. It must be numerically distinct from `SCHED_FIFO`,
`SCHED_RR`, and `SCHED_SPORADIC`, but is implementation-
defined and may behave identically to `SCHED_FIFO` or
`SCHED_RR`.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Add new network interface flag, which allows to disable Multicast
Listener Discovery protocol from being used on the interface. This
allows to interfaces that do not support ND (like OpenThread) to
coexist with other IPv6 interfaces.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add new network interface flag, which allows to disable Neighbour
Discovery protocol from being used on the interface. This allows to
interfaces that do not support ND (like OpenThread) to coexist with
other IPv6 interfaces.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
If the icmsg backend is sending the data from many
contexts, the send buffer must be accessed only by one
context at a time. Ensure that by adding mutex when
sending.
Signed-off-by: Emil Obalski <Emil.Obalski@nordicsemi.no>
Clearing of shared memory by one side of the communication
is no longer required after
commit 0620cb1fe1
("ipc: ipc_service: icmsg: Increase reliability of bonding")
was merged.
Signed-off-by: Emil Obalski <Emil.Obalski@nordicsemi.no>
Some driver may need this information to implement a proper early
initialization procedure.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This is known as the Periodic Advertising Connection Procedure.
The PAwR advertiser can initiate a connection to a synced device and
become the central.
Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
This will (eventually) permit use of a common malloc implementation with
other C libraries, reducing the amount of Zephyr-specific code required
to support each C library.
Signed-off-by: Keith Packard <keithp@keithp.com>
Adds API for Periodic Advertising with Responses - Scanner:
- Synchronize to a PAwR train
- Choose which subevents to synchronize to
- Receive advertising reports from subevents
- Send responses
The support is enabled by CONFIG_BT_PER_ADV_SYNC_RSP, and requires
a controller that selects CONFIG_BT_CTLR_SYNC_PERIODIC_RSP_SUPPORT.
Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
Adds API for Periodic Advertising with Responses - Advertiser:
- Configure parameters
- Receive subevent data requests
- Set subevent data
- Receive response reports
The support is enabled by CONFIG_BT_PER_ADV_RSP, and requires
a controller that selects CONFIG_BT_CTLR_ADV_PERIODIC_RSP_SUPPORT.
Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
Turns out the [first bugfix] was too naive: there is a case where resuming
all channels will not work on all queued SDUs, and the work handler will
give up and wait for the next sent SDU instead of trying to resume again.
This happens when the number of credits and conn contexts is very low for
the amount of data to send.
Always reschedule with a delay to avoid that situation.
[first bugfix]: https://github.com/zephyrproject-rtos/zephyr/pull/50476
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Move additional cache code related to architecture support into arch.h
and leave cache.h with cache API implementation.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Define some macros that will help to define the STM32 ADC resolutions in
the dtsi files. The end goal is to simplify the driver by removing code
specific to particular series.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
The arm-clang compiler/linker does not optimize away unused function
symbols and thus will error if symbols that are referenced are not
defined. To fix this add needed ifdef'ry.
Build various network samples that utilize ethernet but don't have
CONFIG_NET_PROMISCUOUS_MODE will get a link error for:
Error: L6218E: Undefined symbol
net_mgmt_NET_REQUEST_ETHERNET_SET_PROMISC_MODE
(referred from ethernet.o).
Fix by adding ifdef protection around promisc code.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
It is potentially ambiguous as to whether the props array pinter in the
fuel_gauge_get_prop() function permutes the given array.
Explicitly call out that the array will NOT be permuted.
Signed-off-by: Aaron Massey <aaronmassey@google.com>
When `CONFIG_EXTERNAL_CACHE=y`, the `zephyr/cache.h` header file
includes `zephyr/drivers/cache.h`, which then includes `zephyr/cache.h`
again.
This commit fixes the above circular dependency by removing the
unneeded `zephyr/cache.h` inclusion from the `zephyr/drivers/cache.h`.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
Added a generic driver for RaspberryPi Pico PIO.
This driver is an intermediate driver for abstracting the PIO
device driver from physical pin configuration.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
Signed-off-by: Ionut Catalin Pavel <iocapa@iocapa.com>
In some cases, it may be desirable to not have thread-safe reference
counting. For example, when CONFIG_MULTITHREADING=n.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
There is a chance that a previous declaration exists of socklen_t
through the unistd.h header. Luckily that header defines a macro
when it defines the type. This commit therefore uses that define to
know if the type has already been declared or not, similar to what
unistd.h does.
Closes#57195
Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
Add spi_cs_is_gpio(_dt) helpers to check whether SPI CS is controlled by
GPIO or not. This both improves code readability and isolates SPI
internals.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
As of today it is not possible to use SPI dt-spec macros in C++,
something known and documented. The main reason is because `cs` property
is initialized using a compound literal, something not supported in C++.
This PR takes another approach, that is to not make `cs` a pointer but a
struct member. This way, we can perform a regular initialization, at the
cost of using extra memory for unused delay/pin/flags if `cs` is not
used.
Fixes#56572
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
conn_mgr events cannot be used due to mistake in event definitions.
Fix these definitions so that events can be used.
Also patch hole in test coverage that allowed this in the first
place.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Add a new macro, DT_ANY_INST_HAS_PROP_STATUS_OKAY that given a property
name, evaluates to 1 if any enabled instance of `DT_DRV_COMPAT` has the
property or to zero if it hasn't.
This macro can be useful in the context of drivers to optimize
resources.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Fixes the compiler error that occurs when attempting to build
the SNTP library with CONFIG_NET_SOCKETS_POSIX_NAMES=n, while
using native_posix.
Closes#57133
Co-authored-by: Chris Friedt <cfriedt@meta.com>
Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
This adds callbacks for Secure and Private Network Beacons.
SNB callbacks are called after `secure_beacon_authenticate` ends
with success, and Private Beacon callback after Private Beacon
payload is decrypted succsessfully.
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Adding extra documentation to bt_l2cap_le_chan.rx/tx that will help
readers understand what those values mean in practice.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Without `CONFIG_BT_DEVICE_NAME_DYNAMIC`, `bt_set_name` always return
`-ENOMEM`. Users looking to use `bt_set_name` should be pointed to the
relevant kconfig that enables its useful operation.
Also add a "see also" pointer to `CONFIG_BT_DEVICE_NAME_MAX`, which
controls the maximum length of the name passed to `bt_set_name`.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Adds a boot mode system which allows for redirecting the boot
target of a device depending upon the state of a retained value.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Adds a retention system which builds on top of retained_mem
drivers to allow partitioning of areas and data integrity with
magic header prefixes and checksum of stored data.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Changing this enumeration breaks backward compatibility with Wi-Fi shell
as we rely on these values to decide the Wi-Fi security.
Add them at the end to fix backward compatibility.
Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
"flags" is a common variable name and is more likely to be passed
to LOG_DBG() or LOG_ERR() as a parameter. Changing the name of
the local variable created in Z_LOG_MSG_STACK_CREATE() from "flags"
to "_options" make it less likely that someone will pass a parameter
of that name to LOG_DBG() or LOG_ERR() and have that passed value
occluded by the variable created in Z_LOG_MSG_STACK_CREATE.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>