Commit graph

15409 commits

Author SHA1 Message Date
Yuval Peress
3fd0a1508b rtio: fix bug in mempool release API
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>
2023-05-01 09:26:06 -05:00
Yuval Peress
c508ec7506 rtio: add convinience cast
Add a cast to the 'struct rtio_executor *' in the declaration macro for
ease of use.

Signed-off-by: Yuval Peress <peress@google.com>
2023-05-01 09:26:06 -05:00
Yuval Peress
00a7251613 rtio: rework RTIO mempool management
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>
2023-05-01 09:26:06 -05:00
Chris Friedt
b9828a74ab posix: sched: add support for SCHED_OTHER
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>
2023-04-29 13:14:40 -07:00
Yuval Peress
a341a71bd7 math: Update ilog2_compile_time_const_u32 to wrap n with ()
This bug was found when passing a value along with '- 1' to the macro.

Signed-off-by: Yuval Peress <peress@google.com>
2023-04-29 12:25:03 +02:00
Robert Lubos
c349d53150 net: if: Add possibility to disable MLD per interface
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>
2023-04-29 12:24:49 +02:00
Robert Lubos
c43c408783 net: if: Add possibility to disable ND per interface
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>
2023-04-29 12:24:49 +02:00
Emil Obalski
169d8fafdc ipc: icmsg: Add mutual exclussion access to shmem
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>
2023-04-29 12:24:17 +02:00
Emil Obalski
52e203f800 ipc: Remove internal API for clearing shared memory
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>
2023-04-29 12:24:17 +02:00
Gerard Marull-Paretas
054bb26cc5 drivers: regulator: add regulator_common_is_init_enabled
Some driver may need this information to implement a proper early
initialization procedure.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-28 20:38:17 +02:00
Herman Berget
14406cc664 Bluetooth: Host: Fix typos and inaccuracies for PAwR
Fixes some typos and inaccuracies in the PAwR docstrings.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2023-04-28 11:00:48 +02:00
Herman Berget
c961e2c212 Bluetooth: Host: Add support for initiating connections from PAwR
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>
2023-04-28 11:00:48 +02:00
Sam Hurst
0056249a13 usb-c: Add USB-C Subsystem Source PD Support
Add USB-C Power Delivery Source Support to USB-C
Subsystem

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2023-04-28 10:06:01 +02:00
Sam Hurst
d838884bdc usb-c: Document the sink callbacks
Document the sink callbacks

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2023-04-28 10:06:01 +02:00
Keith Packard
a9c62caab7 lib/libc: Move malloc from minimal to common library
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>
2023-04-27 20:17:24 +09:00
Ajay Parida
a004a85ccf net: shell: Check connection & capabilities in any TWT operation
Connection status & AP capabilities checked before any TWT operation
is initiated.

Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
2023-04-27 09:52:00 +02:00
Herman Berget
95bc5cf8e5 Bluetooth: Host: Add support for PAwR Sync
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>
2023-04-26 20:08:16 +02:00
Herman Berget
9021e2f438 Bluetooth: Host: Add support for PAwR Advertiser
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>
2023-04-26 20:08:16 +02:00
Jonathan Rico
6cdb82cb59 Bluetooth: host: l2cap: trigger SDUs that get lost in limbo
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>
2023-04-26 13:53:08 +02:00
Anas Nashif
144b8fbb9f xtensa: cache: add icache implementation from xtensa hal
add icache implementation from xtensa hal.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-26 07:31:22 -04:00
Anas Nashif
6388f5f106 xtensa: use sys_cache API instead of custom interfaces
Use sys_cache instead of custom and internal APIs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-26 07:31:22 -04:00
Anas Nashif
aa4f2bc81e xtensa: move arch non cache API code from cache.h to arch.h
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>
2023-04-26 07:31:22 -04:00
Anas Nashif
319cf30a27 cache: xtensa: implementa arch cache functions
Implement xtensa cache functions supporting the cache API on the
architecture level.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-26 07:31:22 -04:00
Guillaume Gautier
f825e69d8e include: zephyr: dt-bindings: adc: add macros for stm32 adc resolutions
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>
2023-04-26 12:53:03 +02:00
Andreas Kilian
a665fc0829 drivers: sensor: Vishay VEML7700 ambient light sensor
Added support for Vishay VEML7700 ambient light sensor
See https://www.vishay.com/doc?84286

Signed-off-by: Andreas Kilian <andreas_kilian@gmx.net>
2023-04-26 12:52:46 +02:00
Kumar Gala
0090ad718a net: Fix build issues with arm-clang
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>
2023-04-25 19:59:06 +02:00
Aaron Massey
42c9c797cb fuel_gauge: Clarify props array is NOT permuted
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>
2023-04-25 08:52:04 -07:00
Stephanos Ioannidis
8103b86796 drivers: cache: Fix circular dependency between cache API header files
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>
2023-04-25 23:17:27 +09:00
Yonatan Schachter
5abb1b1ec0 drivers: misc: Add driver for RaspberryPi Pico PIO
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>
2023-04-25 13:12:02 +02:00
Gerard Marull-Paretas
9faa60aeda drivers: regulator: allow non-thread-safe reference counting
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>
2023-04-25 12:23:07 +02:00
Hein Wessels
6c934ab247 net: ip: only define socklen_t if not already defined
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>
2023-04-25 12:19:59 +02:00
Gerard Marull-Paretas
1e0028ae3d drivers: spi: add spi_cs_is_gpio(_dt) helpers
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>
2023-04-24 21:29:55 +02:00
Gerard Marull-Paretas
3f2c2d4130 drivers: spi: make SPI dt-spec macros compatible with C++
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>
2023-04-24 21:29:55 +02:00
Georges Oates_Larsen
fdaeabfdb6 net: conn_mgr: Fix event definitions
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>
2023-04-24 16:29:01 +02:00
Gerard Marull-Paretas
44ec128e8b devicetree: introduce DT_ANY_INST_HAS_PROP_STATUS_OKAY
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>
2023-04-24 09:21:36 -05:00
Pawel Osypiuk
4b7f156403 IPC: rpmsg: Changed method of checking bounded endpoints
Initially that was checked by presence of name and now is changed
to check the flag.

Signed-off-by: Pawel Osypiuk <pawelosyp@gmail.com>
2023-04-24 15:45:09 +02:00
Hein Wessels
2689e16670 net: sntp: support building without NET_SOCKETS_POSIX_NAMES
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>
2023-04-24 09:23:17 -04:00
Krzysztof Kopyściński
0a55ec8d52 Bluetooth: Mesh: Add callback for received beacons
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>
2023-04-24 13:36:12 +02:00
Nicolas VINCENT
ac254d1163 doc: flash: Fix typo
the off argument of flash_area_write is used to *write*

Signed-off-by: Nicolas VINCENT <nicolas.vincent@vossloh.com>
2023-04-24 13:35:07 +02:00
Pavel Vasilyev
c4fa085ec4 Bluetooth: Mesh: Add async API for Large Comp Data Client
Add asynchronous API for Large Composition Data Client.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-04-24 13:31:27 +02:00
Aleksander Wasaznik
9b62cc6899 Bluetooth: l2cap.h: Document bt_l2cap_le_chan.rx/tx
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>
2023-04-24 13:31:18 +02:00
Aleksander Wasaznik
b1005460f7 Bluetooth: Host: Document bt_set_name kconfig requirements
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>
2023-04-24 13:31:18 +02:00
Jamie McCrae
7e11b6392b retention: Add boot mode system
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>
2023-04-24 13:27:53 +02:00
Jamie McCrae
64f4404481 retention: Add retention system
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>
2023-04-24 13:27:53 +02:00
Dawid Niedzwiecki
7f7e48e66e mgmt: ec_host_cmd: create chosen string per backend
Create strings to set the chosen node per backend. It is done for
better clarity.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-04-21 16:29:59 +02:00
Dawid Niedzwiecki
1d62002bba mgmt: ec_host_cmd: update configs naming
Just use better namings for the buffer sizes configs.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-04-21 16:29:59 +02:00
Krishna T
f7dbc59e04 net: wifi: Fix backward compatibility
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>
2023-04-21 16:26:44 +02:00
Kumar Gala
30653bfbed console: uart_mux: Use TYPE_SECTION macros for uart_mux
Clean up uart_mux to utilize TYPE_SECTION macros for handling sections.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-21 12:55:38 +02:00
Peter Mitsis
3a08d9620a logging: Change Z_LOG_MSG_STACK_CREATE() variable
"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>
2023-04-21 10:46:43 +02:00
Emil Gydesen
4661e8f480 include: byteorder: Fix incorrect doc for sys_get_le24
The documentation said that it was for big-endian when it
really is for little-endian.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-04-21 09:40:21 +02:00