Commit graph

15409 commits

Author SHA1 Message Date
Cla Mattia Galliard
84f6e7a313 net: tc: Limit the max amount of packets in the traffic-class-fifo
To avoid starvation of a traffic class by another, limit the maximum amount
of packets, that can sit in a single traffic-class-fifo to a fraction of
the maximum amount of available packets. In the tx-case also reserve
packets for direct sending, in the case, where
CONFIG_NET_TC_SKIP_FOR_HIGH_PRIO is enabled.

Signed-off-by: Cla Mattia Galliard <cla-mattia.galliard@zuehlke.com>
2025-01-30 20:27:33 +01:00
Aksel Skauge Mellbye
fc7143ffbc dt-bindings: pinctrl: silabs: Add analog bus bindings
Add definitions for analog bus selections on Series 2 devices.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-01-30 18:30:01 +01:00
Aksel Skauge Mellbye
120691a155 drivers: pinctrl: silabs: Add support for analog bus allocation
The GPIO peripheral on Silabs Series 2 devices is responsible for
allocating analog buses to analog peripherals. Enable support for
this in the pinctrl driver. Since these bus allocations are not
digital pins, introduce a new property silabs,analog-bus for this
purpose.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-01-30 18:30:01 +01:00
Dominik Ermel
22703875bd storage/stream_flash: Deprecate stream_flash_erase_page
The commit marks stream_flash_erase_page as deprecated.
After the function is removed users will have to rely on stream
flash to erase space it needs prior to write.

The stream_flash_erase_page has several issues like using non-relative
offset for erases, allowing to destroy data already written or even
erase out of area available for stream flash.

This fixes #67407

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2025-01-30 14:13:42 +01:00
Dominik Ermel
5c40ee3958 storage/stream_flash: Switch to stream_flash_erase_to_append
Switches flash_sync to use stream_flash_erase_to_append
instead of stream_flash_erase_page in preparation of deprecating
the later and reming control on erase from API user.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2025-01-30 14:13:42 +01:00
Armin Brauns
2fe573b6a1 toolchain: fix compiler version detection for __builtin_unreachable()
The original commit (1716bbdb19) clarifies
that this is supposed to be GCC v4.5.0, not GCC v40.5.0.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2025-01-30 14:10:26 +01:00
Emil Gydesen
8ed24ae3a0 usb: device_next: Make buf ownership consistent for usbd_uac2_send
The usbd_uac2_send function sometimes took ownership of the
provided buffer in error cases, and sometimes not.

The commit modifies the function so that ownership is never
taken in case a non-0 return value.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-01-30 14:08:53 +01:00
Théo Battrel
7884b929fe Bluetooth: Host: Specify parameter needs of bt_set_name
State that the name given to `bt_set_name` must be null terminated.

If not, the behavior of the function may be wrong as it's using `strlen`
to get the length of the given name and `strcmp` to compare it to the
current device name. Both of those functions expect null terminated string.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2025-01-30 11:15:03 +01:00
Hubert Miś
1ee6990fc4 drv: ft8xx: user data in the callback function
The user of the ft8xx driver can register a callback function called
on a touch detection interrupt event. This function is extended to
include a user-defined pointer. The user-defined pointer helps to share
a callback with multiple driver instances.

Signed-off-by: Hubert Miś <hubert.mis@gmail.com>
2025-01-30 02:01:34 +01:00
Hubert Miś
51e732c3ac drv: ft8xx: support multiple instances
Improve the FT8xx display driver to support multiple driver instances.

The ft8xx_reference_api.h still follows the FT8xx programming guides,
limiting the usage of the driver to one instance.

Signed-off-by: Hubert Miś <hubert.mis@gmail.com>
2025-01-30 02:01:34 +01:00
Karol Lasończyk
057de458e2 drivers: adc: Add support for gain 2/7 in nRF devices
Extend current adc gains with new entry 2/7.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
2025-01-29 15:13:19 +01:00
Yong Cong Sin
2c1c9d8029 posix: features: define _POSIX_SUBPROFILE
As our implementations do not meet all of the requirements of a
POSIX.1-conforming implementation.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2025-01-29 15:12:32 +01:00
Maxmillion McLaughlin
b50bb7c2e5 drivers: gnss: Add geoid separation to gnss_info
Currently altitude is only provided above MSL. Adding
geoid seperation allows for ellipsoidal height to be
determined.

Signed-off-by: Maxmillion McLaughlin <max@sorcerer.earth>
2025-01-29 11:02:42 +01:00
Neil Chen
35a489e3be drivers: syscon: update syscon driver to add lpspi clock
Add lpspi clock support

Signed-off-by: Neil Chen <cheng.chen_1@nxp.com>
2025-01-28 23:41:08 +01:00
Guillaume Gautier
671431f8ee include: zephyr: dt-bindings: reset: add stm32n6
Add STM32N6 dt bindings for reset

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-01-28 18:14:45 +01:00
Guillaume Gautier
7930d9c113 drivers: pinctrl: stm32: add pinctrl for stm32n6
Add pinctrl driver for STM32N6

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-01-28 18:14:45 +01:00
Guillaume Gautier
daeb2a8377 drivers: clock: add stm32n6 clock
Add STM32N6 clock driver.
Supported clocks are LSE, LSI, HSE, HSI, PLL1-4, IC1-20,
peripheral clock and CPU clock.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-01-28 18:14:45 +01:00
Matt Rodgers
ea6ca4e8b7 net: http_server: allow specifying a fallback resource
A _res_fallback parameter to HTTP_SERVICE_DEFINE is added to optionally
specify a fallback resource detail, which will be served if no other
resource matches the URL.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2025-01-28 18:14:36 +01:00
Matthias Alleman
d0e98b2425 drivers: input: cy8cmbr3xxx: add support for cy8cmbr3xxx input driver
Support for the cy8cmbr3xxx input driver is added.

Signed-off-by: Matthias Alleman <matthias.alleman@basalte.be>
2025-01-28 14:13:08 +01:00
Emil Gydesen
9688c2d43f Bluetooth: CCP: Initial CCP Client implemenation
Added initial CCP client implementation that simply
does discovery of TBS on a remote CCP server.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-01-28 09:46:39 +01:00
Benedek Kupper
332115cdf6 drivers: udc: use explicit casts from void* to the target type
This header file provides the public API of the UDC driver,
however it also contains inline function definitions.
Unfortunately these definitions contain implicit pointer conversions,
which are one of the cases where valid C syntax is invalid C++ syntax,
meaning that any C++ source code that intends to use the UDC API
cannot be compiled error-free (or warning-free, if using -fpermissive).

Signed-off-by: Benedek Kupper <kupper.benedek@gmail.com>
2025-01-27 17:14:48 +01:00
Joel Holdsworth
52a1db1cf3 kernel: Fixed init_delay initialization on older GCC versions
Within the K_THREAD_DEFINE macro, a nested set of macros is expanded to
populate the values of a global _static_thread_data structure.

The K_THREAD_DEFINE macro expands to statements including the
Z_THREAD_COMMON_DEFINE macro, which expands to statements including the
Z_THREAD_INITIALIZER macro, which expands to an initialization expression
of a _static_thread_data struct. The init_delay member of that struct is
then initialized with the Z_THREAD_INIT_DELAY_INITIALIZER macro, which
expands to an expression including the SYS_TIMEOUT_MS macro which
converts a number of milliseconds to a number of ticks.

For example, take the following macro:

    K_THREAD_DEFINE(
        thread_X,
        STACKSIZE,
        thread_X_entry_point, NULL, NULL, NULL,
        PRIORITY,
        0,
        0);

In abbreviated form, it expands as follows:

    typedef struct {
        int ticks;
    } k_timeout_t;

    struct _static_thread_data {
        /* ... */
        k_timeout_t init_delay;
    };

    struct _static_thread_data _k_thread_data_thread_X = {
        /* ... */
        .init_delay = (k_timeout_t){ .ticks = 0 }
    };

However, in GCC versions before 5.1, the code fails to compile with the
error "initializer element is not constant", when compiled with the
following options:

    gcc -std=gnu99 -c test.c

In the above code, the error can be corrected by replacing...

    .init_delay = (k_timeout_t){ .ticks = 0 }

...with...

    .init_delay = { .ticks = 0 }

...i.e. removing initialization with a compound literal.

In order to achieve this, this patch reworks the system of macros.

The Z_TIMEOUT_TICKS(t) macro is refactored into Z_TIMEOUT_TICKS_INIT(t)
which defines the initializer part: { .ticks = t }, and Z_TIMEOUT_TICKS(t)
which is defined as ((k_timeout_t) Z_TIMEOUT_TICKS_INIT(t)) .

For symmetry, Z_TIMEOUT_NO_WAIT_INIT is split out of Z_TIMEOUT_NO_WAIT.

Similarly, SYS_TIMEOUT_MS_INIT(ms) is split out of SYS_TIMEOUT_MS(ms) so
that the Z_THREAD_INIT_DELAY_INITIALIZER(ms) macro can use
SYS_TIMEOUT_MS_INIT(ms) which expands Z_TIMEOUT_TICKS_INIT(t) to initialize
init_delay without using a compound literal.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-01-27 13:24:52 +01:00
Joel Holdsworth
3901e8b2ff include: Add support for compilers which do not define __SIZEOF_INT__
__SIZEOF_INT__ is required by zephyr_stdint.h, however the __SIZEOF_*__
macros were only introduced in GCC 4.3.

This patch adds a work-around similar to that present in picolibc's
_default_types.h which attempts to guess the correct value of the
definition based on the value of __INT_MAX__ or from INT_MAX from
POSIX <limits.h> .

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-01-27 13:24:52 +01:00
Joel Holdsworth
1716bbdb19 toolchain: gcc: Added fallback for __builtin_unreachable
Support for __builtin_unreachable() was added to GCC in the 4.5.0 release.
This patch adds a fallback to __builtin_trap() for older compilers which
do not have this built-in available.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-01-27 13:24:52 +01:00
Nicolas Pitre
3075a7d906 ring_buffer: factorize almost identical code
Factorize almost identical code. May even improve performance due to
CPU cache locality.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-01-25 01:40:03 +01:00
Wajdi ELMuhtadi
4068d41d4b drivers: sensor: wsen_tids_2521020222501: add sensor driver
Add wsen_tids_2521020222501 driver with
the corrected name and compatibility with
the hal update as well as added new features.

Signed-off-by: Wajdi ELMuhtadi <wajdi.elmuhtadi@we-online.com>
2025-01-24 19:16:17 +01:00
Jiafei Pan
75301887e3 drivers: clock_control: mcux_ccm: add ii2c clock support
Add I2C clock support for imx8m platforms.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2025-01-24 19:15:57 +01:00
Fredrik Gihl
904089ddc5 driver: sensor: tmp116: oversample attribute
Add oversample attribute

Signed-off-by: Fredrik Gihl <fgihl@hotmail.com>
2025-01-24 15:41:50 +01:00
Josuah Demangeon
21da345382 drivers: video: introduce video_bits_per_pixel(pixelformat) helper
This was present in the form of video_pix_fmt_bpp() inside ST and NXP
drivers, and was returning the number of bytes, which does not allow
support for 10-bits, 4-bits or non-byte aligned video formats.
The helper leverages the VIDEO_PIX_FMT_*_BITS macros.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-01-24 03:22:31 +01:00
Josuah Demangeon
a6d68d2166 drivers: video: Make VIDEO_FOURCC() a documented API
Rename video_fourcc() to VIDEO_FOURCC(), differing from the Linux
implementation, but more compliant with the coding style.

Also introduce a VIDEO_FOURCC_FROM_STR() to generate a FOURCC format
code out of a 4-characters string.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-01-24 03:22:31 +01:00
Josuah Demangeon
a1a0788d25 drivers: video: improve video formats documentation
Introduce a new text documentation of the video formats, describing
every bit, gives the position of the most significant bit, outline how
it is cut in bytes, and show the pixel segmentation.

Extra care is taken for the RGB565 which requies paying attention to the
bit endianess as well as the byte endianess.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-01-24 03:22:31 +01:00
Daniel Leung
abb83b97e7 linker: fix lnkr_pinned_rodata_* mismatched types
In linker-defs.h, lnkr_pinned_rodata_[start/end] are declared as
extern char. However, in linker/utils.h:linker_is_in_rodata(),
they are declared as extern const char. So remove the const in
linker_is_in_rodata() to align both declarations.

Fixes #83461

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-01-23 19:22:26 +01:00
Ivan Pankratov
257d9d45ba kernel: sys_heap: stats: save heap pointers to an array during init
To request heap statistics, a pointer to a heap structure is required.
This is straightforward for a user-defined heap. However, such a pointer
is not known for heaps created by other components or libraries, like
libc. Therefore, it is not possible to calculate the total heap memory.

The proposed solution is to use an array of pointers, which is filled in
on every sys_heap_init() call. One can then iterate through it to sum up
the total memory allocated for all heaps.

The array size is configurable. The default array size is zero,
which means the feature is disabled. Any other integer greater then zero
defines the array size and enables the feature.

A list of pointers instead of an array could be another approach,
but it requeres a heap, which is not always available.

Signed-off-by: Ivan Pankratov <ivan.pankratov@silabs.com>
2025-01-23 16:37:33 +01:00
Robert Lubos
225b587a90 net: pkt: Add API documentation for net_pkt_get_len
net_pkt_get_len() was commonly used yet not documented, move the
function out of the doxygen-ignored section of the header and add
a doxygen API description for the function so that it's rendered in
the documentation properly.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-23 16:32:49 +01:00
Yong Cong Sin
085df8bd1e arch: remove z_arch_esf_t
The exception stack frame type `z_arch_esf_t` had been deprecated
since #73593 for 2 releases, it is not used in the kernel since, and
applications/drivers should have been updated to use the
`struct arch_esf` now, remove it.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2025-01-23 16:32:36 +01:00
Robert Lubos
78c3996b59 net: ethernet: Allow drivers to reserve net_pkt headroom
Add new Ethernet driver config option,
ETHERNET_CONFIG_TYPE_EXTRA_TX_PKT_HEADROOM, which allows Ethernet
drivers to inform L2 about the extra net_pkt headroom they need to be
allocated.
This is only supported when CONFIG_NET_L2_ETHERNET_RESERVE_HEADER is
enabled, so that it's possible to fit entire packet into a single
net_buf, which is needed for zero-copy transmission.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-23 16:31:41 +01:00
Jakub Rzeszutko
8991b954bc shell: add Kconfig option for configurable autoflush behavior
Introduced a new Kconfig option `SHELL_PRINTF_AUTOFLUSH` to allow
configuring the autoflush behavior of shell printing functions.

Updated `Z_SHELL_FPRINTF_DEFINE` to use the
`CONFIG_SHELL_PRINTF_AUTOFLUSH` setting instead of hardcoding
the autoflush behavior to `true`.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@verkada.com>
2025-01-23 13:45:20 +01:00
Håvard Reierstad
e13e893dfc net: buf: revert disallowing blocking in syswq
Reverts the change made in d4d53010f00cadbb4f89c6d41391937646fc1740
(The changes was moved to another file in a restructuring)

The commit incorrectly assumed that no blocking would be allowed in
the syswq. This has caused issues observed among others
in #77241 and #80167

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2025-01-23 10:14:59 +01:00
Alvis Sun
2d465707c9 dts: arm: npcx: add I2C port helper macro
As title.

Signed-off-by: Alvis Sun <yfsun@nuvoton.com>
2025-01-23 05:22:57 +01:00
Guennadi Liakhovetski
76e1e1b804 llext: fix Z_GENERIC_SECTION() usage
Z_GENERIC_SECTION() uses STRINGIFY() to convert its argument to a
string, therefore the argument shouldn't contain additional quotes.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2025-01-22 20:50:00 +01:00
Yasin Ustuner
2c3ae462a2 include: zephyr: dt-bindings: Add MAX78000 DMA binding
This commit adds binding file for DMA slots.

Signed-off-by: Yasin Ustuner <Yasin.Ustuner@analog.com>
2025-01-22 20:47:21 +01:00
Fredrik Danebjer
21b5f0c4fe Bluetooth: pacs: Add dynamic PACS registration
Added option to set the PACS Characteristics through the bap API,
making PACS configuration runtime available. Source and Sink PAC, as
well as Source/Sink PAC Location is can be set through a register
function in the PACS api.

Signed-off-by: Fredrik Danebjer <frdn@demant.com>
2025-01-22 15:49:50 +01:00
Luca Burelli
b0dbbb7782 device: add CONFIG_LLEXT_EXPORT_DEV_IDS_BY_HASH option
This new option allows to export devices using identifiers generated
from the hash of the devicetree node path, instead of the device's
ordinal number. Identifiers generated this way are stable across
rebuilds.

Add new test cases to test this new option.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-01-22 15:49:10 +01:00
Luca Burelli
1bb939a836 llext: add custom name variant to symbol export macros
Add a new set of macros that allow customizing the symbol name when
exporting symbols. This is useful when the symbol name that extensions
need to look up is different from the identifier used in the base image.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-01-22 15:49:10 +01:00
Luca Burelli
16d71d0598 edtlib: add "hash" attribute to nodes
Add a new "hash" attribute to all Devicetree EDT nodes. The hash is
calculated on the full path of the node; this means that its value
remains stable across rebuilds.
The hash is checked for uniqueness among nodes in the same EDT.

This computed token is then added to `devicetree_generated.h` and made
accessible to Zephyr code via a new DT_NODE_HASH(node_id) macro.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-01-22 15:49:10 +01:00
Jukka Rissanen
594fa24199 net: ethernet: Properly handle VLAN tag 0
Packets are forwarded to the native interface or in other words,
the vlan header is simply stripped and ignored. This feature is called
'priority tagging'.

Signed-off-by: Cla Mattia Galliard <cla-mattia.galliard@zuehlke.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-22 10:47:52 +01:00
Pieter De Gendt
ab26ecce6e linker: iterable_section: Allow numeric sorting up to 5 numeric characters
This allows using a uint16_t value to sort iterable sections.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-01-22 10:40:45 +01:00
Bas van Loon
e1ba85e9a2 drivers: ethernet: Fix DSA tag size for KSZ8863.
Allow DSA_TAG_SIZE to be set based on the size determined by Kconfig
and the enabled switch hardware.

This fixes support for the KSZ8863 which also has a tail tag of
one byte.

Signed-off-by: Bas van Loon <s.r.vanloon@ziggo.nl>
2025-01-22 05:40:58 +01:00
Nicolas Pitre
29ae9e3435 kernel/pipe: implement direct-to-pending-readers data copy
If there are pending readers, it is best to perform a single data copy
directly into their final destination buffer rather than doing one copy
into the ring buffer just to immediately copy the same data out of it.

Incidentally, this allows for supporting pipes with no ring buffer at all.

The pipe implementation being deprecated has a similar capability so better
have it here too.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-01-21 19:44:57 +01:00
Jukka Rissanen
ab9b85b199 net: Build assert issue with llvm
Remove the build assert from NET_L3_REGISTER() macro as that
is causing an issue with llvm. Add runtime check of the handler
pointer value.

subsys/net/l2/ethernet/arp.c:1044:1: error: static_assert expression
is not an integral constant expression

ETH_NET_L3_REGISTER(ARP, NET_ETH_PTYPE_ARP, arp_recv);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/net/ethernet.h:1272:2: note: expanded from
macro 'ETH_NET_L3_REGISTER'
        NET_L3_REGISTER(&NET_L2_GET_NAME(ETHERNET), name, ptype, handler)
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/net/net_core.h:190:2: note: expanded from
macro 'NET_L3_REGISTER'
        BUILD_ASSERT((_handler) != NULL, "Handler is not defined")
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/toolchain/gcc.h:87:51: note: expanded from
macro 'BUILD_ASSERT'
define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
                                                  ^~~~~~
subsys/net/l2/ethernet/arp.c:1044:1: note: cast from 'void *' is not
allowed in a constant expression
include/zephyr/net/ethernet.h:1272:2: note: expanded from
macro 'ETH_NET_L3_REGISTER'
        NET_L3_REGISTER(&NET_L2_GET_NAME(ETHERNET), name, ptype, handler)
        ^
include/zephyr/net/net_core.h:190:29: note: expanded from
macro 'NET_L3_REGISTER'
        BUILD_ASSERT((_handler) != NULL, "Handler is not defined")
                                   ^
/usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h:89:16: note: expanded
from macro 'NULL'
  define NULL ((void*)0)

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-21 19:29:55 +01:00