Commit graph

15409 commits

Author SHA1 Message Date
Carlo Caione
c2ec3d49cd arm64: cache: Enable full inlining of the cache ops
Move all the cache functions to a standalone header to allow for the
inlining of these functions.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-04-20 14:56:09 -04:00
Carlo Caione
d3ed4a784b cache: Rework headers and force inlining
The current headers do not allow the full inlining of the cache
functions. Rework and cleanup the headers to allow for the full
inlining.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-04-20 14:56:09 -04:00
Carlo Caione
de90dfccbc syscall: Introduce __syscall_always_inline
Sometimes we want to force the inlining of a __syscall. Introduce a new
__syscall_always_inline symbol to do that.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-04-20 14:56:09 -04:00
Bjarki Arge Andreasen
418da35697 include/drivers/rtc.h: Refined documentation
Hid type definitions of API functions from documentation
using INTERNAL_HIDDEN condition.

Changed nested groups inside rtc_interface group to use
@name instead.

Use @anchor to reference definitions for
RTC_ALARM_TIME_MASK.

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
2023-04-20 11:43:35 +02:00
Guennadi Liakhovetski
a0a0739992 log: fix a harmless bug
Z_LOG2() has a typo, confusing & with &&. The result is the same but
using && is more logical in that case and it eliminates a flood of

warning: dubious: x & !y

static analyser warnings. Also compare to 0 explicitly to fix a
coding style violation.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-04-20 10:52:18 +02:00
Kumar Gala
caea9dc196 logging: Use TYPE_SECTION macros for log strings
Clean up log_strings to utilize macros for handling sections.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-20 10:52:07 +02:00
Kumar Gala
301d0c4712 net: buf: cleanup net_buf_pool use of iterable section
Cleanup linker scripts for net_buf_pool section to use the linker
script related iterable section macros.

Also replace _net_buf_pool_list with macro's instead to complete
iterable section usage.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-20 10:50:04 +02:00
Emil Gydesen
da9096c103 Bluetooth: BAP: Add guard of BIS specific CC data
The data can only be used if CONFIG_BT_CODEC_MAX_DATA_COUNT
is non-0.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-04-20 10:47:10 +02:00
Pieter De Gendt
6e0dfe50bf include: net: dns_sd: Explicit DNS service struct members
Convert the DNS service struct initialization to use explicit
member names.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-04-19 11:55:40 -04:00
Kumar Gala
eec299c130 pm: Use TYPE_SECTION macros for pm_device_slots
Clean up pm_device_slots to utilize TYPE_SECTION macros for handling
sections.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-19 17:15:29 +02:00
Eduardo Montoya
760d8fc970 modules: openthread: align received frame timestamp to SFD
OpenThread requires that the `mTimestamp` parameter from the `mRxInfo`
struct points to the end of SFD, i.e. beggining of PHR.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2023-04-19 17:15:02 +02:00
Kumar Gala
47cf00058e fb: cfb: Use TYPE_SECTION macros for cfb_fonts
Clean up cfb_fonts to utilize TYPE_SECTION macros for handling sections.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-19 17:14:54 +02:00
Kumar Gala
7469ad426a drivers: pcie: Use TYPE_SECTION macros for irq_alloc
Clean up irq_alloc to utilize TYPE_SECTION macros for handling sections.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-19 17:14:46 +02:00
Kumar Gala
5b5fbc4c11 shell: remove dead linker section for shell
The initshell sections in the linker scripts where associated with theo
old shell code.  The old shell code has been removed for some time so
remove references to initshell in the linker scripts and size_calc.py

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-19 17:14:37 +02:00
Victor Chavez
b8e1ee1042 device: Fixed CPP compatiblity for Z_DEVICE_HANDLES_DEFINE
By using the __weak attribute with the macro `Z_DEVICE_HANDLES_DEFINE`
C++ throws the error "weak declaration must be public". This change
adds the keyword extern if the macro is included in a C++ source
file.

Signed-off-by: Victor Chavez <chavez-bermudez@fh-aachen.de>
2023-04-19 10:02:12 +02:00
Victor Chavez
bd59170402 device: Fixed CPP compatiblity for Z_DEVICE_INIT
The macro `Z_DEVICE_INIT` is not compatible with C++ due to
initialization order of the struct device. This commit fixes
the initialization for compatiblity with C++.

Signed-off-by: Victor Chavez <chavez-bermudez@fh-aachen.de>
2023-04-19 10:02:12 +02:00
Emil Gydesen
5e19ef0748 Bluetooth: CAP: Remove packing from unicast audio start param
The packing field was never used.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-04-19 10:01:06 +02:00
Gerard Marull-Paretas
1b73d1e0c6 drivers: can: allow NULL init function
Generic device API allows for NULL init function, do the same for I2C.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-19 10:00:25 +02:00
Gerard Marull-Paretas
40957e3b49 drivers: i2c: allow NULL init function
Generic device API allows for NULL init function, do the same for I2C.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-19 10:00:25 +02:00
Gerard Marull-Paretas
4d06166623 device: allow NULL init function
Some devices do not need to perform any initialization, so allow the
init function to be NULL. In this case, the initialization code will
just mark the device as initialized, i.e. ready.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-19 10:00:25 +02:00
Daniel DeGrasse
6f938f347b drivers: interrupt_controller: introduce PINT driver
Introduce PINT driver, for NXP pin interrupt and pattern match engine.
The driver currently supports only the pin interrupt feature of the
PINT.

Add DTS entires for the PINT on LPC and RT devices that support this
peripheral, and remove the interrupt defintions that are PINT specific
from the GPIO module on these devices.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-04-18 16:14:57 -05:00
Peter Hoyes
2f2f3edacd toolchain: gcc: Fix separator between directives on same line
The Arm assembler in binutils 2.40 contains a change [1] which affects
how multiple directives on the same line are parsed.

Previously, the following combination of directives parsed successfully:

    .code 32 .balign 4

With binutils 2.40, the following error is now seen:

    Error: junk at end of line, first unrecognised character is `.'

To fix, insert a semicolon after '.code 32', as there already is after
'.thumb'.

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=a37854f9162fac592b669eda53f465fc190c9341

Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
2023-04-18 12:22:21 -04:00
Kumar Gala
1105fa9092 rtio: Remove unused linker section
rtio is utilizing iterable sections so the explicit linker
code does not need to exist so we can remove it.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-18 12:21:24 -04:00
Kumar Gala
6b5139c4bb shell: Convert to using iterable sections
Convert handling of shell_root_cmds, shell_subcmds, and
shell_dynamic_subcmds to use iterable section macros.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-18 12:48:16 +02:00
Georges Oates_Larsen
7c4397ae79 net: conn_mgr: connectivity API
Allows L2s to declare generic association/connection routines
that can be bound by name to ifaces.

Allows L2-agnostic control over connectivity/association for
iface that support it.

Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
2023-04-18 09:31:53 +02:00
Krzysztof Chruscinski
f167e5c9b4 logging: Fix LOG_RAW failing when logging is disabled
Macro was not taking into account case when logging was disabled
and it was failing to link in that case.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-04-17 22:24:08 -04:00
Andrzej Głąbek
8fba8aa535 drivers: flash: nrf_qspi_nor: Add custom API function to allow XIP
Normally, the driver deactivates the QSPI peripheral for periods when
no QSPI operation is performed. This is done to avoid increased current
consumption when the peripheral is idle. For the same reason, the base
clock on nRF53 Series SoCs (HFCLK192M) is configured for those periods
with the default /4 divider that cannot be used otherwise. However,
when XIP accesses are used, the driver must be prevented from doing
both these things as that would make XIP to fail. Hence, a function
is provided so that applications can inform the driver that XIP is
needed and the above idle actions should be suppressed.
This function (`nrf_qspi_nor_xip_enable()`) replaces the old one
(`nrf_qspi_nor_base_clock_div_force()`) that was intended for similar
purpose but after deactivation of the peripheral was introduced in
commit 95d867e8ed it became useless.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-04-17 16:43:16 +02:00
Johann Fischer
4c6a5e0fa3 usb: add a note about the return value of usb_transfer_sync()
The transfer completion callback does not provide a way to pass
transfer status to the transfer submitter.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-04-17 11:30:48 +02:00
romain pelletant
eab19663a9 net: lwm2m: add callback for send confirmation
Issue #52328

Signed-off-by: romain pelletant <romainp@kickmaker.net>
2023-04-17 11:29:14 +02:00
Kumar Gala
39ec490534 toolchain: common: iterable sections: Add generic type macros
Add a set of macros that can be utilized for any type and redefine
the struct macros to utilize these macros.  While the majority of
uses for iterable sections are for structs, there are some cases
where the elements of the section might be a union or some other
type.

Also added <STRUCT|TYPE>_SECTION_<START|END>_EXTERN helper macros to
give a common means to handle setting externs in rare case they
are needed.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-17 10:19:53 +02:00
Ajay Parida
d961a483c3 net: wifi_mgmt: fix for function name mismatch
changes for mismatch between .h and .c file in
function name..

Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
2023-04-17 10:17:37 +02:00
Théo Battrel
1008bf186b Bluetooth: Host: Define new macro for Bluetooth data
Add a new macro called `BT_DATA_SERIALIZED_SIZE` in `bluetooth.h` that
calculate the total size of a serialized `bt_data` given a `data_len`.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-04-17 10:15:04 +02:00
Andy Sinclair
0d68c86c95 drivers: gpio: npm1300: Initial driver for nPM1300 PMIC
Initial GPIO driver for NPM1300 PMIC

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-04-17 10:14:40 +02:00
Andy Sinclair
d1e201ccf6 drivers: regulator: npm1300: Initial driver for nPM1300 PMIC
Initial regulator driver for Nordic NPM1300 PMIC.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-04-17 10:14:40 +02:00
Gerard Marull-Paretas
667eeb11fb shell: fix MISRA 5.7 violations on struct shell
MISRA Rule 5.7 requires uniqueness of tag identifiers. Shell is
frequently problematic because many code uses `const struct shell
*shell`. This causes CI noise every time one of these shell files is
edited, so let's update all of them with `const struct shell *sh`
instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-14 12:21:08 +02:00
Jaroslaw Stelter
b8d9b833a2 intel_adsp: ace20_lnl: dmic: Add HDA channel map programming
Add new field to dai_config structure and function that
program it in HW register.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2023-04-13 20:51:10 -04:00
Paul Fagerburg
04611a5735 init: set init_entry.dev to NULL
[PR#51217](https://github.com/zephyrproject-rtos/zephyr/pull/51217)
changed the `init_entry` structure, but `Z_INIT_ENTRY_NAME` (called
by `SYS_INIT` or `SYS_INIT_NAMED`) does not initialize all of the
members of the struct, leading to errors when building with
`-Werror=missing-field-initializers`.

Change the macro to initialize the `dev` member to `NULL` so that
all members of the struct are initialized.

Signed-off-by: Paul Fagerburg <pfagerburg@google.com>
2023-04-13 17:36:29 -04:00
Gerard Marull-Paretas
6d192e50cf init/device: add missing __noasan
__noasan attribute was accidentally removed by
a5fd0d184a. Add it back as it is causing
some address sanitizer issues when using the LLVM toolchain.

Details on why this is needed can be found in
74cc534758.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-13 13:39:54 +02:00
Leifu Zhao
1cb259a43b arch/x86/ia32: Add option to reserve GDT entries
Some functions such as the ISH power management function needs to
reserve GDT entry place holders which are filled during runtime.
Add config option to define the number of GDT entry place holders
reserved and change the ia32 linker script accordingly.

Signed-off-by: Leifu Zhao <leifu.zhao@intel.com>
2023-04-13 05:43:20 -04:00
Yuval Peress
83ec915b0f rtio: Update headers for C++ compatibility
- Fix initialization order (C++ requires struct fields to be
  initialized in the same order they were declared).
- Fix casting issue in 'for' loop conditions
- Fix casting issues when getting atomic values

Signed-off-by: Yuval Peress <peress@google.com>
2023-04-13 09:59:31 +02:00
Yuval Peress
5257580edc libc: Add extern "C"
Add missing extern "C" guards that are needed when this header
is included in C++

Signed-off-by: Yuval Peress <peress@google.com>
2023-04-13 09:59:31 +02:00
Gerard Marull-Paretas
b21e0054af drivers: i2c: remove deprecated I2C_NODE_MASTER
Remove deprecated I2C_NODE_MASTER definition. It has shipped deprecated
2 releases (3.2, 3.3) so it can be removed now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-13 09:59:19 +02:00
Fredrik Danebjer
7e416c8ec0 Bluetooth: audio: csis: Fix Big Endianness for RSI generation
This changes so that generation of RSI now uses LE arrays instead of
uint32 words. Both input and output of rsi and sih genration now uses
LE. This also fixes the generation of RSI for BE systems, which
wasn't working.

Signed-off-by: Fredrik Danebjer <fredrik@danebjer.com>
2023-04-12 17:44:29 +02:00
Gerard Marull-Paretas
4863c5f05b sys/util: extend usage of DIV_ROUND_UP
Many areas of Zephyr divide and round up without using the DIV_ROUND_UP
macro. Make use of it, so that we make use of a tested system macro and
at the same time we make code more readable.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-12 16:42:29 +02:00
Gerard Marull-Paretas
a5fd0d184a init: remove the need for a dummy device pointer in SYS_INIT functions
The init infrastructure, found in `init.h`, is currently used by:

- `SYS_INIT`: to call functions before `main`
- `DEVICE_*`: to initialize devices

They are all sorted according to an initialization level + a priority.
`SYS_INIT` calls are really orthogonal to devices, however, the required
function signature requires a `const struct device *dev` as a first
argument. The only reason for that is because the same init machinery is
used by devices, so we have something like:

```c
struct init_entry {
	int (*init)(const struct device *dev);
	/* only set by DEVICE_*, otherwise NULL */
	const struct device *dev;
}
```

As a result, we end up with such weird/ugly pattern:

```c
static int my_init(const struct device *dev)
{
	/* always NULL! add ARG_UNUSED to avoid compiler warning */
	ARG_UNUSED(dev);
	...
}
```

This is really a result of poor internals isolation. This patch proposes
a to make init entries more flexible so that they can accept sytem
initialization calls like this:

```c
static int my_init(void)
{
	...
}
```

This is achieved using a union:

```c
union init_function {
	/* for SYS_INIT, used when init_entry.dev == NULL */
	int (*sys)(void);
	/* for DEVICE*, used when init_entry.dev != NULL */
	int (*dev)(const struct device *dev);
};

struct init_entry {
	/* stores init function (either for SYS_INIT or DEVICE*)
	union init_function init_fn;
	/* stores device pointer for DEVICE*, NULL for SYS_INIT. Allows
	 * to know which union entry to call.
	 */
	const struct device *dev;
}
```

This solution **does not increase ROM usage**, and allows to offer clean
public APIs for both SYS_INIT and DEVICE*. Note that however, init
machinery keeps a coupling with devices.

**NOTE**: This is a breaking change! All `SYS_INIT` functions will need
to be converted to the new signature. See the script offered in the
following commit.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

init: convert SYS_INIT functions to the new signature

Conversion scripted using scripts/utils/migrate_sys_init.py.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

manifest: update projects for SYS_INIT changes

Update modules with updated SYS_INIT calls:

- hal_ti
- lvgl
- sof
- TraceRecorderSource

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: devicetree: devices: adjust test

Adjust test according to the recently introduced SYS_INIT
infrastructure.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: kernel: threads: adjust SYS_INIT call

Adjust to the new signature: int (*init_fn)(void);

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-12 14:28:07 +00:00
Wojciech Slenska
2615241de3 drivers: w1: added casting
This casting is needed in c++ to avoid compilation error.

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2023-04-12 08:59:51 +02:00
Thomas Stranger
77d2490164 arch: arm: core: aarch32: rename z_NmiHandlerSet
rename the function that sets the handler for the nmi.
It should be namespaced and not camel-case:
z_NmiHandlerSet to z_arm_nmi_set_handler

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2023-04-12 08:59:36 +02:00
Peter Mitsis
1995aaeb14 drivers: mm: Fix include header guard
Fixes the include header guard so that it does not use
kernel.h's.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-04-12 08:58:06 +02:00
Aastha Grover
408472673e arch: xtensa: Fix xtensa error handler
In case of recoverable fatal errors the execution should
switch to another thread. This will ensure the current_cpu nested
count is reset  when there is a context switch.

Signed-off-by: Aastha Grover <aastha.grover@intel.com>
2023-04-11 14:48:51 -04:00
Carles Cufi
943fc715a5 include: rtio: Remove use of deprecated ceiling_fraction macro
Commit 53da110dbf deprecated
ceiling_fraction in favor of DIV_ROUND_UP. Apply this to the rtio
header as well.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-04-11 13:59:26 +02:00