Commit graph

15409 commits

Author SHA1 Message Date
Emil Gydesen
db2624def4 Bluetooth: BAP: Remove scan and PA sync from broadcast sink
This removes the scanning and PA sync capabilities from the
broadcast sink implementation, moving the responsibility of this
to the application layer.

The reason for this is to add more flexibility and choice to the
upper layers, while simplifying the Broadcast Sink implementation.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-14 13:34:26 +00:00
Emil Gydesen
4f966de74b Bluetooth: CAP: Add cap stream send and tx sync
Add bt_cap_stream_send and bt_cap_stream_get_tx_sync for
CAP streams

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-14 13:33:57 +00:00
Emil Gydesen
da874178ff Bluetooth: BAP: Fix note in bt_bap_stream_send
The @note in bt_bap_stream_send did not make any sense, and has
been replaced with a new note.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-14 13:33:57 +00:00
Emil Gydesen
8600356f98 Bluetooth: BAP: Add bt_bap_stream_get_tx_sync
Add bt_bap_stream_get_tx_sync to get the ISO tx info from a BAP
stream.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-14 13:33:57 +00:00
Emil Gydesen
e882847cf3 Bluetooth: BAP: Add can_send field to bt_bap_ep_info
This makes it easier to check if a stream, or ep, can send.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-14 13:33:57 +00:00
Uma Praseeda
d11c0a1664 doc: Doxygen fixes in conn.h
Fixes the issue of some doxygen comments not being visible in the
documentation.

Signed-off-by: Uma Praseeda <uma.praseeda@nordicsemi.no>
2023-08-12 12:16:59 +02:00
Benjamin Cabé
38775fa6db doc: net: conn_mgr: Doxygen cleanup
Added some missing doxygen comments (missing javadoc style syntax)
Fixed some brief descriptions
Added named heading in conn_mgr_conn_binding

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-08-11 12:01:41 +00:00
Benjamin Cabé
b6a501b2e9 doc: time_units: Add to Time Utility docs
Add time units helpers to the Time Utility APIs category.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-08-11 11:59:55 +00:00
Mykola Kvach
d9fe261f8e drivers: regulator-fixed: extend api of driver (list/count voltages)
Allow properties 'regulator-min-microvolt' and 'regulator-max-microvolt'
for fixed regulators: Note: they should be equal.

Add simple functions for getting list of allowed and count of voltages.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2023-08-10 18:11:35 +00:00
Mykola Kvach
ed9ca0f6d3 drivers: regulator-fixed: add possibility to work without enable pins
Possible situation is that in some driver, devices can be controlled in
different ways: in some, we can only turn the power on or off, in others,
we can only control the voltage, and in some, we can control power supply
or voltage level. There may also be devices where there is no control
over power supply at all. A clear example of this can be eMMC devices
where the voltage is usually fixed and they are always powered on.
However, we would like to have a common code for controlling all the
mentioned types of devices, at least the driver shouldn't worry about the
implementation details of voltage regulators. Therefore, there may exist
empty regulators - regulators that only contain information about the
supported voltage, and we cannot change anything in them. The device tree
node description for such a regulator is only necessary for compatibility
with other regulators. Hence, we need to add the possibility of the
existence of such a dummy fixed-regulator.

In this commit, support for a fixed dummy regulator without the ability
for any control has been added. Note that such support also exists in the
Linux kernel. In other words, the logic of the fixed regulator has been
aligned with the logic of the fixed regulator inside the Linux kernel.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2023-08-10 18:11:35 +00:00
Joshua Lilly
cce530cae4 scripts: build: gen_isr_tables: make bit masks configurable
Some architectures such as RISC-v support more than 255 interrupts
per aggrigator. This diff adds the ability to forgo the aggrigator
pattern and use a configurable number of bits for multilevel
interruts.

Signed-off-by: Joshua Lilly <jgl@meta.com>
2023-08-10 10:55:41 -04:00
Fabio Baltieri
a534169ed4 input: rename callback define macro to INPUT_CALLBACK_DEFINE
Looking back at the current INPUT_LISTENER_CB_DEFINE api naming, it
feels like it's a bit overloaded. Rename it to a simpler
INPUT_CALLBACK_DEFINE.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-10 08:15:10 +00:00
Daniel Leung
b22db9892e sys: rename local variables in WAIT_FOR()
This renames the local variables in WAIT_FOR() to make them
more unique to avoid them being shadow variables.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:12 +00:00
Daniel Leung
a952055ba3 lib: cbprintf: renames shadow variables
Renames shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:12 +00:00
Daniel Leung
9c0ff33e04 kernel: rename shadow variables
Renames	shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:12 +00:00
Daniel Leung
6b740b20de riscv: renames shadow variables
In print_pmp_entries(), start and end are function arguments
and yet another start and end are declared inside the for
loop. So rename the function arguments to fix shadow variables
warning.

The changes in csr_*() macros are needed to avoid shadowing
__v when nesting those functions together, for example,
csr_write(..., csr_read(...)).

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:12 +00:00
Daniel Leung
88c43566fa arm64: renames shadow variables
Renames	shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:12 +00:00
Daniel Leung
6f6f7d6cd7 toolchain: gcc: rename argument for UNALIGNED_GET()
Rename the argument for UNALIGNED_GET() from p to g.
This fixes shadow variable warning of __p if UNALIGNED_GET()
is nested with UNALIGNED_PUT().

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:12 +00:00
Daniel Leung
7c4e641f84 debug: rename shadow variables
This renames the shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:12 +00:00
Daniel Leung
179c46be03 syscall: Z_SYSCALL_VERIFY_MSG to ignore -Wshadow
Z_SYSCALL_VERIFY_MSG() does LOG_MODULE_DECLARE() internally to
log errors during verification. However, this is definitely
going to conflict with any LOG_MODULE_DECLARE() in the source
file using Z_SYSCALL_VERIFY_MSG(). So we need to selectively
disable -Wshadow for Z_SYSCALL_VERIFY_MSG() to avoid compiler
warnings as this is an intentional behavior.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:12 +00:00
Daniel Leung
8dc9d89d29 toolchain: introduce macros to ignore -Wshadow
This introduces two macros TOOLCHAIN_IGNORE_WSHADOW_BEGIN and
TOOLCHAIN_IGNORE_WSHADOW_END which can be used inside another
macro to ignore -Wshadow for certain block of code. This is
useful for common macros that may nest upon themselves
(for example, logging).

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:12 +00:00
Benjamin Cabé
3f1868e0f9 doc: drivers: i2s: doxygen cleanup
Added missing doxygen comments + fixed improperly documented structure.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-08-09 18:33:44 +00:00
Jani Hirsimäki
83ea1e26a2 net: l2: ppp: ppp uart usage fixed
This fixes 3 issues that came within PR #59124 for ppp uart usage.

Earlier start/stop of ppp was done at enable() but that
was removed in PR #59124. Now putting enable/disable() back and
putting start/stop there.
Additionally, there was a double ppp carrier ON when NET_EVENT_IF_DOWN.
For that net_if_carrier_on/off is set in uart ppp.c driver.
Also, maybe worth to be mentioned that after PR #59124 there is no
ppp carrier off when lcp is disconnected, for workaround that change,
application should use ppp dead/running events.

Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
2023-08-09 16:07:46 +00:00
Immo Birnbaum
9e9e60b67f arch: aarch32: fix z_mapped_start location for non-XIP operation
Move the z_mapped_start marker for non-XIP builds to the base RAM address.
This has already been the marker's location when building for XIP.

Prior to this change, z_mapped_start was located at the start of the
text section for non-XIP builds. However, at least for the Cortex-A
family of CPUs, the first section located at the RAM base address
isn't the text section, but the single 4k page containing the exception
vectors which are copied to either address 0 or the HIVECS address upon
early boot.

This resulted in this first 4k page at the bottom of RAM to be considered
available for memory mappings via the MMU at run-time, followed by all
the permanently mapped stuff, with available mappable memory only
continuing behind z_mapped_end. A call at run-time requesting memory to
be mapped via the MMU therefore always assigned the single 4k page
containing the vectors data first, before continuing mapping physical
memory behind z_mapped_end. For any map call requesting more than 4k,
this resulted in a contiguous virtual memory address range mapped to
non-contiguous physical memory. This behaviour has already been
documented in #51024.

This behaviour would also cause further problems in case of support
for the Cortex-A's VBAR register, which has been proposed before, but
eventually wasn't merged. Letting VBAR point to the RAM base where
the 4k vectors page is located within the Zephyr image instead of
copying the vectors to either 0 or the HIVECS address means that this
page may under no circumstance be re-assigned for use as regular RAM
mapped via the MMU.

Signed-off-by: Immo Birnbaum <mail@birnbaum.immo>
2023-08-09 16:05:24 +00:00
Immo Birnbaum
36997de796 arch: aarch32: place .bss, .noinit sections at the end of the binary
This is a follow up to #53262, which still lacked the adjustment of the
.noinit section's position within the binary by the time the PR went
stale.

Adjust the linker command file so that the .bss and .noinit sections
are placed at the end of the resulting binary. Until now, those sections
have been located somewhere in the middle of the binary, so that the
inclusion of structures like statically defined heaps or large zero-
initialized arrays reflected 1:1 in the resulting binary's size. Even
for a stripped binary, such data was included in full as the linker
couldn't omit it due to subsequent sections within the binary.

This fix has been tested with a 32 MB statically allocated heap and
a 32 MB uint8 zero-initialized array. Both structures are clearly
identifyable in the memory consumption statistics, however, the final
binary's size is unaffected by their inclusion.

Signed-off-by: Immo Birnbaum <mail@birnbaum.immo>
2023-08-09 16:05:24 +00:00
Diego Elio Pettenò
65f7f741f3 usb_tcpc: fix typo.
"verion" should obviously have been "version".

Signed-off-by: Diego Elio Pettenò <flameeyes@meta.com>
2023-08-09 13:47:22 +00:00
Benjamin Cabé
12e484cd41 drivers: dac: doc: Cleanup Doxygen documentation
Fixed Doxygen doc for dac_channel_cfg struct.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-08-09 07:47:45 -04:00
Benjamin Cabé
e439ed2da1 doc: sys: onoff: cleanup doxygen documentation
Cleaned up some inconsistencies or mistakes in the way onoff.h
was documented.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-08-09 07:41:22 -04:00
Flavio Ceolin
d16c5b9048 kernel: canaries: Allow using TLS to store it
Add new option to use thread local storage for stack
canaries. This makes harder to find the canaries location
and value. This is made optional because there is
a performance and size penalty when using it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-08-08 19:08:04 -04:00
Benjamin Cabé
68b1930309 include: rb: doc: Move code to make Doxygen happy
Moved alloca.h trick further down the file to workaround Doxygen
getting confused with #ifdef/#ifndef.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-08-08 13:02:47 -04:00
Benjamin Cabé
9dbb1ecc53 include: rb: doc: RB-tree doc wording
Small tweaks to balanced RB-tree's doc wording

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-08-08 13:02:47 -04:00
Benjamin Cabé
72f5923981 include: doc: Add missing docs for data structures
Data structures in Modules > Utilities > Data Structures were missing
some documentation.
Also properly hid the structures' internals (note that for some of the
files touched by this commit, some internals were already de-facto
hidden by Doxygen as they begin with an _ character).

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-08-08 13:02:47 -04:00
Benjamin Cabé
e00e2108c9 include: doc: Properly document data structures
Move brief and description under group instead of file so that they show
up nicely in the documentation.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-08-08 13:02:47 -04:00
Benjamin Cabé
1a85866935 drivers: peci: doc: Doxygen cleanup
Put command format defines in proper sections and fix improperly
documented struct.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-08-08 13:01:28 -04:00
Robert Lubos
32bd3aa781 net: iface: Allow NULL pointer to be handled in net_if_is_ip_offloaded
In case native interface is used with NET_OFFLOAD enabled, the
net_if_is_ip_offloaded() could lead to a crash, if called on unbound
net_context (i.e. with no iface assigned to net_context yet).

As since commit 40d2240226 the net_context
allocated on offloaded interface is always assigned with the iface
pointer during its creation, it can be safely assumed that in case of
NULL pointer is provided we deal with a native interface. Therefore
instead of asserting on the iface pointer, indicate that the interface
is native when NULL pointer is provided.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-08-08 08:15:53 +00:00
Grzegorz Swiderski
e28cbb3633 devicetree: Add DT_FIXED_PARTITION_ADDR macro
This convenience API returns the absolute address of a fixed partition,
i.e., relative offset + base address. It's distinct from `DT_REG_ADDR()`
and `FIXED_PARTITION_OFFSET()`, both of which return just the offset.

The base address is taken from the parent memory node as given by the
newly added `DT_MEM_FROM_FIXED_PARTITION()`. This is expected to ensure
that the returned address is directly addressable by the CPU. This is
also meant to prevent `DT_FIXED_PARTITION_ADDR()` from working with
external memory partitions.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-08-07 15:45:23 +02:00
Grzegorz Swiderski
99599b5d3b devicetree: Add DT_MEM_FROM_FIXED_PARTITION macro
This is a new fixed-partitions API, which serves as a companion to the
existing `DT_MTD_FROM_FIXED_PARTITION()`. In the following example:

  flash-controller@0 {
          compatible = "flash-controller";
          flash@1000000 {
                  compatible = "soc-nv-flash";
                  partitions {
                          compatible = "fixed-partitions";
                          partition@3a000 {};
                  };
          };
  };

`DT_MTD_FROM_FIXED_PARTITION()` would let us map `partition@3a000` to
`flash-controller@0`. Now, the new `DT_MEM_FROM_FIXED_PARTITION()` can
let us retrieve the memory node (`flash@1000000`) as well, in a manner
consistent with the existing API.

Caution: if a fixed partition is not said to belong to a memory node,
like in this alternative example:

  flash@0 {
          compatible = "spi-nor";
          partitions {
                  compatible = "fixed-partitions";
                  partition@0 {};
          };
  };

then `DT_MEM_FROM_FIXED_PARTITION()` will map `partition@0` to an
invalid node identifier. This partition belongs to `flash@0`, which
could be an MTD on a SPI bus.

For consistency, the existing `DT_MTD_FROM_FIXED_PARTITION()` is now re-
expressed in terms of the new `DT_MEM_FROM_FIXED_PARTITION()`.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-08-07 15:45:23 +02:00
Fabio Baltieri
b8e27297fa input: input-event-codes: add few extra definitions
Add few extra definitions used by board DTSs and some that seems to make
sense for potential applications. These match the code and name of the
Linux event codes.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-07 11:26:26 +02:00
Konrad Derda
409b15c7ce net: event: provide complete information about the prefix in events
At the moment, NET_EVENT_IPV6_PREFIX_ADD and NET_EVENT_IPV6_PREFIX_DEL
events provide provide information about an address without its length
and lifetime.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2023-08-07 11:25:40 +02:00
Tom Burdick
108b38b357 rtio: Fix signed compare warning
atomic_t is a machine word signed integer but cq_count is meant to be an
unsigned positive only count of total completions. Cast when needed to
ensure the correct math and comparisons are being done.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-08-05 09:34:07 +00:00
Tom Burdick
0aaedf7205 docs: rtio: Show RTIO API Docs again
The RTIO API docs weren't being shown. I made a poor assumption thinking
I could simply include the top level doxygen group in index.rst which isn't
the case. Fix the groups, and remove a note about a poll function
that doesn't exist yet.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-08-04 12:30:05 -04:00
Gerard Marull-Paretas
28c139f653 drivers: pm_cpu_ops: psci: provide sys_poweroff hook
Instead of implementing a custom power off API (pm_system_off),
implement the sys_poweroff hook, and indicate power off is supported by
selecting HAS_POWEROFF. Note that according to the PSCI specification
(DEN0022E), the SYSTEM_OFF operation does not return, however, an error
is printed and system is halted in case this occurs.

Note that the pm_system_off has also been deleted, from now on, systems
supporting PSCI should enable CONFIG_POWEROFF and call the standard
sys_poweroff() API.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-04 16:59:36 +02:00
Gerard Marull-Paretas
90b247b90b lib: os: add support for system power off
Add a new API to perform an immediate system power off:
`sys_poweroff()`.

Until now, this functionality has been implemented via the system power
management module, but in a clunky fashion. The way system PM works is
by defining some idle states in devicetree, that, given some properties
(e.g. minimal residency, exit latency, etc.) are automatically selected
when system goes to idle based on the expected next wake-up. However,
system off is a power state that one typically wants to control manually
from the application because it implies state loss, and in most cases,
configuring some sort of wake-up source. So in general, it is not
desired to let the system enter this state automatically. This led to
the following stuff in-tree:

from `boards/arm/mimxrt595_evk/mimxrt595_evk_cm33.dts`:

```c
/*
 * Deep power-down mode is supported in this SoC through
 *  'PM_STATE_SOFT_OFF' state. There is no entry for this in device tree,
 *  user can call pm_state_force to enter this state.
 */
```

That is, state not being defined in devicetree so that PM subsystem
doesn't pick it automatically, but still implemented in in the PM hooks:

from `soc/arm/nxp_imx/rt5xx/power.c`, `pm_state_set()`:
```c
case PM_STATE_SOFT_OFF:
	set_deepsleep_pin_config();
	POWER_EnterDeepPowerDown(EXCLUDE_FROM_DEEP_POWERDOWN);
	break;
```

And to actually make use of this state, users had to do this kind of
abominations:

```c
pm_state_force(0u, &(struct pm_state_info){ PM_STATE_SOFT_OFF, 0, 0 });

/* Now we need to go sleep. This will let the idle thread runs and
 * the pm subsystem will use the forced state. To confirm that the
 * forced state is used, lets set the same timeout used previously.
 */
k_sleep(K_SECONDS(SLEEP_S));

printk("ERROR: System off failed\n");
while (true) {
	/* spin to avoid fall-off behavior */
}
```

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-04 16:59:36 +02:00
Mathieu Anquetin
26f4fab391 drivers: led: lp503x: extend driver to all lp50xx devices
Add support for LP5009, LP5012, LP5018 and LP5024 devices which only
differ by the number of LEDs they can control.

Also, update application sample to run on all these new supported
devices.

Based on initial work from:
  - Marek Janus <marek.janus@grinn-global.com>
  - Rico Ganahl <rico.ganahl@bytesatwork.ch>

Signed-off-by: Mathieu Anquetin <mathieu.anquetin@groupe-cahors.com>
2023-08-04 13:18:01 +02:00
Jamie McCrae
4b9dddcd3a mgmt: mcumgr: grp: os_mgmt: Add force parameter to reset command
Adds the force parameter to the reset command which is now
provided to the callback hook (if enabled).

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-08-04 12:17:07 +02:00
Maciej Sobkowski
8a670d0713 drivers: pinctrl: Add pinctrl driver for Apollo4
This commit addst pinctrl support for Apollo4 SoCs.

Co-authored-by: Mateusz Sierszulski <msierszulski@antmicro.com>
Signed-off-by: Maciej Sobkowski <msobkowski@antmicro.com>
2023-08-04 10:48:58 +02:00
Seppo Takalo
4aeb80b374 kernel/timeout: Introduce comparison for timepoint values
Introduce new API to compare two timepoint values to
find the one that is going to expire sooner, or is already
expired.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-08-04 10:41:15 +02:00
Franciszek Zdobylak
64da407ea5 fs: ext2: create dir and file operations
Introduced functions:
  - open
  - close
  - mkdir

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Franciszek Zdobylak
1eccf55102 fs: ext2: Implementation of basic operations
Included operations:
  - mount
  - unmount
  - mkfs
  - statvfs

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-08-03 12:22:01 -04:00
Nicolas Pitre
90eac6e4bc timepoints: minimal compatibility with CONFIG_SYS_CLOCK_EXISTS=n
When timers are configured out, timepoint-based timeouts are reduced to
"no wait" or "wait forever" only.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-08-03 10:29:46 +02:00