Commit graph

70969 commits

Author SHA1 Message Date
Keith Short 2f2c0176e5 include: fix includes for IT8xxx2 SoC
Fix missing includes for IT8xxx2 drivers.

Signed-off-by: Keith Short <keithshort@google.com>
2022-10-12 16:10:05 -04:00
Keith Short fbdc34e0b1 include: fix includes for NPCX drivers
Add include of kernel.h for drivers using Kernel APIs.

Signed-off-by: Keith Short <keithshort@google.com>
2022-10-12 16:10:05 -04:00
Keith Short a328bc0183 include: fix native_posix_counter includes.
Add limits.h and irq.h to fix build errors for boards/tests that include
the zephyr,nativer-_posix-counter driver.

Signed-off-by: Keith Short <keithshort@google.com>
2022-10-12 16:10:05 -04:00
Francois Ramu e01bee5bcc kernel: idle: fix -Werror=misleading-indentation
Warnings being treated as errors when building :
Error this 'for' clause does not guard...
[-Werror=misleading-indentation]

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-10-12 18:43:15 +02:00
Peter Tönz 46a59124dc net: lwm2m: Fix seg-faults if a socket was closed in the meantime
Our application (posix-naive/debug) ran into segmentaion faults,
because the socket was closed between the "wait for sockets" and the
second if in the first loop. Added the check also to line 690
and 720.
The other uses of sock_ctx[i] are already checked against NULL

Signed-off-by: Peter Tönz <peter.tonz@husqvarnagroup.com>
2022-10-12 18:42:41 +02:00
Martin Jäger 9973dc59cf tests: misc: iterable_sections: add const specifier for ROM data
Without the const specifier the data is stored in RAM instead of ROM.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-10-12 18:42:28 +02:00
Martin Jäger 57e0ea6f98 toolchain: common: iterable sections: improve documentation
The macro STRUCT_SECTION_ITERABLE can only store items in ROM if a
const specifier is added to the struct declaration.

Also it does not create the iterable section itself, but adds an
element to the section.

This commit clarifies the documentation.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-10-12 18:42:28 +02:00
Torsten Rasmussen 8941aebc49 sysbuild: support loading of CMakeCache from Zephyr projects
This commit loads the CMakeCache of Zephyr projects.

This allows sysbuild to fetch information from Zephyr projects into
sysbuild itself.

This commit is a first step in the process of sharing more knowledge
between images and sysbuild, and pave the way for closer sharing of
settings between images.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-10-12 18:42:01 +02:00
Piotr Pryga c2ea0328fa Bluetooth: Controller: df: Fix spelling errors
Fix spelling errors in coments in ull_df.c source file.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-10-12 18:41:54 +02:00
Piotr Pryga 3987259888 Bluetooth: Controller: df: Relax cl CTE RX enable param check
According to Core 5.3 Vol 4, Part E, section 7.8.82 slot_durations,
switch_pattern_len and ant_ids are used only for AoA and do not affect
reception of AoD CTE.

To improve interoperability checking of correctness of these parameters
is not required. It will not affect lower link layer in case the AoA
CTE reception feature is not enabled in Kconfig.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-10-12 18:41:54 +02:00
Guillaume Gautier aba432348b drivers: Cleans variable scopes for STM32 drivers
Fix the scope of some variables in various STM32 drivers including:
 - SDMMC
 - DMA
 - OSPI/QSPI Flash
 - Interrupt controller

The variables are set static instead of global and const if appropriate.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-10-12 18:41:48 +02:00
Mariusz Skamra 9c3f190721 Bluetooth: audio: capabilities: Hide bt_audio_capability_get function
This function exposes list pointer, so that it allows the user to modify
the internal list. This adds bt_audio_foreach_capability iterator finction
that can be used instead.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-10-12 18:41:22 +02:00
Florian Grandel 580d789cd0 net: l2: ieee802154: fix frame type field check
The LLDN frame has been obsoleted in IEEE 802.15.4-2015f. This change
removes it from the code, introduces frame types from current spec
levels and updates the frame validation rules in accordance with the
spec.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-10-12 18:40:59 +02:00
Florian Grandel 675757c601 net: l2: ieee802154: remove struct padding in context
This change re-orders attributes in struct ieee802154_context to
completely optimize struct padding away. This is done in a way that does
not impact readability.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-10-12 18:40:59 +02:00
Florian Grandel 14c608e9c4 net: l2: ieee802154: improved context thread safety
Several attributes in the ieee802154_context struct may potentially be
accessed from different threads and/or ISR context. Only some of these
attributes were properly guarded against race conditions.

This may not have been to problematic in the past but as other changes
in this PR introduce additional attributes and mutate several attributes
in a single atomic transaction, leaving such changes unprotected seems
dangerous.

This change therefore introduces systematic locking of the
ieee802154_context structure.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-10-12 18:40:59 +02:00
Florian Grandel 6a6b89516d net: l2: ieee802154: improve short address support
IEEE 802.15.4 short address support is incomplete in several places.
This change improves short address support without claiming to fix
it everywhere. Future iterations will have to continue where this change
leaves off.

The purpose of this change was to:
 * use the short address returned by association responses,
 * automatically bind IEEE 802.15.4 datagram sockets to the short
   address if available,
 * use the short address in outgoing packages where applicable,
 * improve validation of association/disassociation frames,
 * model association more closely to the spec by tying it to the
   existence of a short address in the MAC PIB thereby removing
   redundancy in the PIB (which makes race conditions less probable),
 * keep both, the short and extended addresses, of the coordinator.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-10-12 18:40:59 +02:00
Florian Grandel 1b658494d9 net: ip: test and clear net_if flag
This change introduces an additional function into the API that allows
to test and clear a net_if flag atomically. A similar function already
exists to test and set a flag. So this change actually improves symmetry
of the API.

The change is required in later commits of this PR.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-10-12 18:40:59 +02:00
Florian Grandel bff6a5cce5 net: l2: ieee802154: fix short/ext address endianness
This changes fixes several bugs and inconsistencies in the IEEE 802.15.4
L2 implementation. These bugs were revealed while documenting intended
endianness of driver, IP, socket and L2 attributes (see previous
changes).

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-10-12 18:40:59 +02:00
Florian Grandel b951f062f5 net: l2: ieee802154: add short address to ll address
This is a preparatory change that fixes one aspect of short address
handling before fixing endianness so that the endianness fix can be
applied consistently in this method.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-10-12 18:40:59 +02:00
Florian Grandel b309822e8e samples: net: wpanusb: document endianness
The WPAN-USB sample did not document endianness of some user space
variables. As the IEEE 802.15.4 stack uses attributes in several
different encodings, the endianness should be documented.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-10-12 18:40:59 +02:00
Florian Grandel 34999a8b3e net: l2: ieee802154: document endianness
The IEEE 802.15.4 L2 code stores representation of attributes like
PAN id, short address and extended address in different encodings:

* big endian for extended address and CPU byte order for everything
  else whenever such attributes enter user space (except for IP/socket
  link layer addresses which are always big endian - even in case of
  short addresses - to maintain POSIX compatibility).

* little endian for everything that is close to the radio driver as
  IEEE 802.15.4 frames are little endian encoded.

Endianness was almost nowhere documented which led to several bugs and
inconsistencies where assignments of different byte order were not
converted (or sometimes converted, sometimes not).

This change documents endianness wherever possible within the realm of
the IEEE 802.15.4 L2 code. Conversion bugs and inconsistencies that were
revealed by the improved documentation will be fixed in a separate
commit.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-10-12 18:40:59 +02:00
Florian Grandel a05f0f3f7f net: ip: document endianness
To maintain POSIX compatibility, link-layer addresses are encoded in big
endian in the IP stack and socket API.

The intended endianness was however not documented everywhere which led
to bugs and inconsistencies. The IEEE 802.15.4 L2 stack, for example,
sometimes stores addresses in little endian in structures that intend
them to be stored in POSIX-compliant big endian byte order.

This change documents intended endianness within the realm of the
IP and sockets stack. Conversion bugs are fixed in a separate commit.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-10-12 18:40:59 +02:00
Florian Grandel 631f117ed1 drivers: ieee802154: document endianness
The IEEE 802.15.4 radio driver encodes attributes in:

* little endian for everything that is close to the protocol as
  IEEE 802.15.4 frames are little endian encoded.

* mixed big and little endian in its configuration where extended
  addresses are being represented. These inconsistencies are unfortunate
  but cannot be easily fixed in a backwards compatible way so will be
  left untouched in this change.

Endianness was almost nowhere documented which explains these
inconsistencies and led to several bugs where assignments of different
byte order are not converted (or sometimes converted, sometimes not).

This change documents intended endianness within the realm of the
IEEE 802.15.4 radio driver code. Conversion bugs are fixed in a separate
commit.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-10-12 18:40:59 +02:00
Florian Grandel 7ea6cc99ce net: ip: fix minor formatting glitch
This changes just fixes an erroneous indentation from a previous patch.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-10-12 18:40:59 +02:00
Pierre-Emmanuel Novac 10ae545e9e dts/arm/st/f1: stm32f107: add Ethernet MAC
Ethernet MAC dts definition for STM32F107, similar to STM32F207 but with
different clocks, especially no PTP clock.

Signed-off-by: Pierre-Emmanuel Novac <piernov@piernov.org>
2022-10-12 18:40:49 +02:00
Pierre-Emmanuel Novac 105cca639d drivers/ethernet: stm32: Make PTP clock optional
STM32F107 has an Ethernet MAC but no PTP clock, so remove hard requirement
on PTP clock definition in preparation for STM32F107 Ethernet MAC support.

Signed-off-by: Pierre-Emmanuel Novac <piernov@piernov.org>
2022-10-12 18:40:49 +02:00
Daniel DeGrasse 0f33fa9c32 boards: arm:mimxrt685_evk: update PMIC to support mode setting
Update PCA9420 PMIC to support mode setting feature

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-12 18:40:24 +02:00
Daniel DeGrasse 07b2145727 boards: arm:mimxrt595_evk: update PMIC to support mode setting
Update PCA9420 PMIC to support mode setting feature

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-12 18:40:24 +02:00
Daniel DeGrasse f37c8cc77e drivers: regulator: add support to PMIC regulator driver for modes
Add support for setting the target mode for a PMIC regulator. Some
regulators support multiple modes, each with distinctive voltage and
current configuration data. This function allows the consumer to switch
the PMIC into a new mode. The PMIC can then be configured to use a new
set of voltages.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-12 18:40:24 +02:00
Daniel DeGrasse 1d50265a2f include: dt-bindings: update regulator defintions for PCA9420 for modes
Update regulator binding definitions for PCA9420 to support mode setting
features. This will allow the 4 voltage modes present on the PCA9420 PMIC
to be utilized.

Note that bindings have also been updated to indicate the default
register value and target voltage for each regulator on the PCA9420.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-12 18:40:24 +02:00
Daniel DeGrasse a5bc496c2b dts: bindings: add mode selection properties for regulator-pmic
Add mode selection properties for regulator-pmic compatible. These
mode selection properties will be used with regulators that support
multiple modes, with each mode enabling specific voltage and current
limits.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-12 18:40:24 +02:00
Daniel DeGrasse 30d71d5457 drivers: regulator: move I2C reg reads to regulator_read_register
Move I2C register reads to regulator_read_register in regulator driver,
to enable better abstraction of regulator I2C reads

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-12 18:40:24 +02:00
Daniel DeGrasse f367897bce drivers: regulator: refactor PMIC binding to use physical PMIC IC
Refactor binding to use root PMIC IC, so that properties can be shared
between regulator devices. Each individual regulator output is still
created as an individual device, since the regulator API aligns with
these devices better than the PMIC IC itself.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-12 18:40:24 +02:00
Pawel Czarnecki 6cc8f31310 drivers: counter: add missing includes
Add missing irq.h, spinlock.h and kernel.h headers

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-10-13 00:07:37 +09:00
Filip Kokosinski 63af094af4 MAINTAINERS: update hal_silabs maintainers
This comits updates the maintainers and collaborators lists for the
hal_silabs area.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2022-10-12 09:47:46 -05:00
Adrian Warecki ed661a6c69 dai: dmic: Add missing include header
The code was missing #include <zephyr/kernel.h> which
caused a compilation error. Missing header has been added.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2022-10-12 10:08:54 -04:00
Christopher Friedt dbe2c0d59e include: net: http: rename http_x.h http/x.h
Some minor housekeeping prior to adding an http server
implementation. There are already a number of http headers
and that number will likely increase with subsequent work.
Moving them into a common directory cleans up the
`include/net` directory a bit.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2022-10-12 09:02:21 -04:00
Christopher Friedt f6b73f413c include: net: http: define http response status codes
Provide a common header enumerating HTTP response status codes.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2022-10-12 09:02:21 -04:00
Christopher Friedt ef142c117e scripts: net: add enumerate_http_status.py
Add a script to extract HTTP status values and format them
in a way that is both human readable and machine parseable.

Each line of output is of the form:

```
HTTP_{key}_{upper_val} = {key}, /**< val */
```

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2022-10-12 09:02:21 -04:00
Christopher Friedt 4382df571f include: net: http: move http methods to separate header
Previously, HTTP method enumerations were only defined within
the `http_parser.h`, which may not be ideal for all use cases.

This commit moves the `enum http_method` definition to a
dedicated header in a dedicated `http` subdirectory.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2022-10-12 09:02:21 -04:00
Henrik Brix Andersen f393e2205c drivers: can: mark CAN-FD data phase timing API as optional
The can_set_timing_data() API function is optional and is not supported by
all CAN controller drivers.

On a board with only either classic CAN or CAN-FD capable controllers the
current behavior is fine, but on boards with a mix of classic CAN and
CAN-FD capable controllers/drivers, calling can_set_timing_data() on a
classic CAN controller will lead to a NULL pointer dereference.

To ensure a proper behavior when calling can_set_timing_data() on classic
CAN controller drivers, change the API wrapper function to return -ENOSYS
if the CAN driver does not implement CAN-FD support.

Note that the data phase timing calculation functions are fine as-is, as
the timing calculations will fail due to minimum/maximum data phase timing
parameters being all zeros for drivers only supporting classic CAN.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-10-12 18:49:33 +09:00
Henrik Brix Andersen dad8364d5f drivers: can: document which API functions are optional
Document that the can_get_max_filters() and can_get_max_bitrate() API
functions are optional.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-10-12 18:49:33 +09:00
Gerard Marull-Paretas e5eade32e2 shell: device_service: fix MISRA 5.7 violation
Changes in device_service have triggered MISRA 5.7 violation CI error
(Tag name should be unique). Renamed shell to sh, same as some other
modules.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-12 18:49:12 +09:00
Gerard Marull-Paretas 751f685043 init: format file
Format according our guidelines.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-12 18:49:12 +09:00
Gerard Marull-Paretas 476b3adc79 init: remove redundant Z_SYS_NAME
All init entries are already prepended with `__init_`, there's no point
in pre-pending 2 prefixes.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-12 18:49:12 +09:00
Gerard Marull-Paretas 1529d19ee7 init: s/entry_name/init_id
Use the `init_id`, in line with recent device changes, as the argument
is being used as a unique identifier.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-12 18:49:12 +09:00
Gerard Marull-Paretas 3f474b29a6 init: rename macro parameters
Remove unnecessary underscores where possible as there are no name
clashes.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-12 18:49:12 +09:00
Gerard Marull-Paretas bd364aecd4 init: improve Doxygen
- Create a sys_init entry, as init API is not strictly related to the
  device model (device model re-uses it)
- Hide internals (Z_*) from public API docs.
- Give overview within the group definition of allowed levels, meaning,
  etc.
- Properly document struct init_entry.
- Multiple style issues

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-12 18:49:12 +09:00
Gerard Marull-Paretas 495245a971 init: remove _SYS_INIT_LEVEL* definitions
The _SYS_INIT_LEVEL* definitions were used to indicate the index entry
into the levels array defined in init.c (z_sys_init_run_level). init.c
uses this information internally, so there is no point in exposing this
in a public header. It has been replaced with an enum inside init.c. The
device shell was re-using the same defines to index its own array. This
is a fragile design, the shell needs to be responsible of its own data
indexing. A similar situation happened with some unit tests.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-12 18:49:12 +09:00
Gerard Marull-Paretas 831239300f kernel: move z_sys_init_run_level to init.c
The function in charge of calling all init function was defined in
device.c, had a public prototype and was just used in init.c. Since this
is really an internal function tied to Kernel init code, move it to
init.c and make it static, there's no need to expose it publicly.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-12 18:49:12 +09:00