Commit graph

15409 commits

Author SHA1 Message Date
Carlo Caione
18636af6d6 arm64: Add frame-pointer based stack unwinding
Add the frame-pointer based stack unwinding on ARM64.

This is a typical output with the feature enabled:

*** Booting Zephyr OS build zephyr-v3.4.0-1029-gae22ff648c16 ***
E: ELR_ELn: 0x00000000400011c8
E: ESR_ELn: 0x0000000096000046
E:   EC:  0x25 (Data Abort taken without a change in Exception level)
E:   IL:  0x1
E:   ISS: 0x46
E: FAR_ELn: 0x0000000000000000
E: TPIDRRO: 0x0100000040011650
E: x0:  0x0000000000000000  x1:  0x0000000000000003
E: x2:  0x0000000000000003  x3:  0x000000004005c6a0
E: x4:  0x0000000000000000  x5:  0x000000004005c7f0
E: x6:  0x0000000048000000  x7:  0x0000000048000000
E: x8:  0x0000000000000005  x9:  0x0000000000000000
E: x10: 0x0000000000000000  x11: 0x0000000000000000
E: x12: 0x0000000000000000  x13: 0x0000000000000000
E: x14: 0x0000000000000000  x15: 0x0000000000000000
E: x16: 0x0000000040004290  x17: 0x0000000000000000
E: x18: 0x0000000000000000  lr:  0x0000000040001208
E:
E: backtrace  0: fp: 0x000000004005c690 lr: 0x0000000040001270
E: backtrace  1: fp: 0x000000004005c6b0 lr: 0x0000000040001290
E: backtrace  2: fp: 0x000000004005c7d0 lr: 0x0000000040004ac0
E: backtrace  3: fp: 0x000000004005c7f0 lr: 0x00000000400013a4
E: backtrace  4: fp: 0x000000004005c800 lr: 0x0000000000000000
E:
E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
E: Current thread: 0x40011310 (unknown)
E: Halting system

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-07-13 17:04:05 +02:00
Pavel Vasilyev
c89be95274 Bluetooth: Mesh: Fix comment for BT_MESH_DFU_PHASE_UNKNOWN
The phase was added to the spec, so it is not metaphase anymore.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-07-13 13:26:11 +00:00
Benjamin Cabé
db53c3fd2c doc: Drop asterisk from Doxygen @param
The name for Doxygen params that are pointers should not include an
asterisk.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-07-13 13:25:28 +00:00
Gerard Marull-Paretas
908865ef4b bluetooth: conn: remove trailing dot
It was causing Doxygen issues (End of list marker found without any
preceding list items).

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-07-13 14:27:56 +02:00
Andrey VOLKOV
9e526dba97 gpio: add "gpio-reserved-ranges" support to GPIO_PORT_PIN_MASK_XX
Updated the implementation of the GPIO_PORT_PIN_MASK_FROM_DT_NODE and
GPIO_PORT_PIN_MASK_FROM_DT_INST macros to support
"gpio-reserved-ranges" device tree property.

Signed-off-by: Andrey VOLKOV <andrey.volkov@munic.io>
2023-07-13 12:16:44 +02:00
Andrey VOLKOV
6587fccd65 drivers: gpio: add "gpio-reserved-ranges" property support
Added

   * GPIO_DT_RESERVED_RANGES_NGPIOS(node_id, ngpios),
   * GPIO_DT_RESERVED_RANGES(node_id),
   * GPIO_DT_INST_RESERVED_RANGES_NGPIOS(inst, ngpios) and
   * GPIO_DT_INST_RESERVED_RANGES(inst)

as DT gpio's "gpio-reserved-ranges" property missing support.
The array of pins range pairs as shown below now works.

Also implemented paired extended versions of
GPIO_PORT_PIN_MASK_FROM_NGPIOS macro:

   * GPIO_DT_PORT_PIN_MASK_NGPIOS_EXC(node_id, ngpios) and
   * GPIO_DT_INST_PORT_PIN_MASK_NGPIOS_EXC(inst, ngpios)

with reserved (ie EXCluded) pins support too.

The implementation constraint is inherited from common DT limitations:
a maximum of 64 pairs can be used, i.e. theoretically no more than
128-bit gpio ports are supported (but resulted bitmask is actually
limited by the size of gpio_port_pins_t type).

Usage example:
The reserved mask, defined in the device tree as:
    gpio0: gpio0 {
       ....
       ngpios=<32>;
       gpio-reserved-ranges = <0 8>, <9 5>, <15 16>;
       ....
    };

and used in driver configuration as:
    {
     ...
     .gpio_reserved = GPIO_DT_RESERVED_RANGES(DT_NODELABEL(gpio0)),
     .pin_port_mask = GPIO_DT_PORT_PIN_MASK_NGPIOS_EXC(
				DT_NODELABEL(gpio0),
				DT_PROP(DT_NODELABEL(gpio0), ngpios)),
     ...
    }

correctly converts to:

    .gpio_reserved = 0x7fffbeff, 0b01111111 11111111 10111110 11111111)
    .pin_port_mask = 0x80004100, 0b10000000 00000000 01000001 00000000)

Signed-off-by: Andrey VOLKOV <andrey.volkov@munic.io>
2023-07-13 12:16:44 +02:00
Andrey VOLKOV
c35d97534f include: util_internal: add Z_SPARSE_LIST_{ODD|EVEN}_NUMBERS
Add auxiliary lists Z_SPARSE_LIST_ODD_NUMBERS and
Z_SPARSE_LIST_EVEN_NUMBERS. These lists were originally created for
GPIO_DT_RESERVED_RANGES_NGPIOS macro, but may be useful for others
applications too.

Signed-off-by: Andrey VOLKOV <andrey.volkov@munic.io>
2023-07-13 12:16:44 +02:00
Gerard Marull-Paretas
4c4e2c5213 drivers: spi: fix spi_config structure documentation
`@param` can't be used to document struct fields. Inline each field
documentation and improve it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-07-13 09:21:45 +02:00
Gerard Marull-Paretas
2c3165d187 drivers: spi: add opaque type to encode SPI operation flags
Since flags can use either 16/32-bit depending on
CONFIG_SPI_EXTENDED_MODES, add a new opaque type that uses the correct
bit-width depending on that option. This allows us to simplify the
structure layout.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-07-13 09:21:45 +02:00
Gerard Marull-Paretas
8ce048b8e1 drivers: spi: fix CS documentation
`spi_cs_control` `cs` field is no longer a pointer, but a struct member.
Clarify it must be zero-initialized if not used. Remove confusing
comment about the need to use `device_is_ready()` on `cs` field,
`spi_is_ready_dt()` is the only thing users need to do.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-07-13 09:21:45 +02:00
Benjamin Cabé
5fe47c255b include: sys: util_macro: Add UTIL_DEC(x) doc
Added missing Doxygen documentation for UTIL_DEC(x) macro.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-07-13 09:21:00 +02:00
Benjamin Cabé
262b72a2fa include: sys: util_macro: remove duplicate DEFINEs
Some UTIL_INC_*** DEFINEs were incorrectly appearing twice.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-07-13 09:21:00 +02:00
Benjamin Cabé
3544e9163d include: sys: util_macro: fix bogus UTIL_X2 defs
Fixed some invalid defines in the UTIL_X2_*** series.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-07-13 09:21:00 +02:00
Benjamin Cabé
ae22ff648c emul: doc: Fix SBS Gauge emulator doc typos
Capitalized group name to preserve alphabetical order in device driver APIs
list, and fixed minor typo (backed->backend)

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-07-12 16:39:31 +02:00
Marcel Krüger
8d6f74ad1f pm: Supplement pm_device_is_powered doc
Supplement the documentation pm_device_is_powered()
adding that a device is assumed powered in case
the device does not support PM or is not on a power domain.

Signed-off-by: Marcel Krüger <marcel.krueger@ithinx.io>
2023-07-12 14:53:59 +02:00
Anders Storrø
8c7ffac4a6 Bluetooth: Mesh: Fix err in mod_app_list packing
Fixes erroneous packing/unpacking of model app list messages
in the configuration client and server. According to the mesh 1.1
protcol spec (4.3.1.1) two app indexes shall be packed in a 3 octet
interleaved format. The current implementation packs them in 4 octets.

This commit also provide a helper function for unpacking key indexes
as public API to facilitate future config model callback API.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-07-12 14:37:23 +02:00
Andy Sinclair
4048348e3e drivers: gpio: gpio_npm1300: Added reset and power loss modes
Added configuration of nPM1300 GPIO pins as reset or
power loss warning.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-07-12 14:36:56 +02:00
Andy Sinclair
c793764549 drivers: mfd: mfd_npm1300: Added timer configuration function
Timer configuration function added

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-07-12 14:36:56 +02:00
Dawid Niedzwiecki
b04692b747 mgmt: ec_host_cmd: add user callback for a new command
Add a user possibility to set a callback for receiving a new function.
It allows instant performing some actions, that need to be done before
context switch.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-07-12 09:26:42 +02:00
Dawid Niedzwiecki
b6a3254d8b mgmt: ec_host_cmd: verify a command before passing it to handler
Verify validity of a received command before passing it to the general
handler.

It allows performing some actions, right after receiving the command.
The context switch is not needed. Such feature may be needed for
overloaded system, where instant reboot is required.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-07-12 09:26:42 +02:00
Dawid Niedzwiecki
1b6d6fb135 mgmt: ec_host_cmd: add function to signal a new command
Add a function to signal a new host command by a backend.

Use a function instead of giving semaphore, because it allows more
actions on rx event, common for all backends.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-07-12 09:26:42 +02:00
Dawid Niedzwiecki
7a479eec0d mgmt: ec_host_cmd: save result of IN_PROGRESS command
Add a config to save the final result of a last host command that has
sent EC_HOST_CMD_IN_PROGRESS response. To get the final result use the
ec_host_cmd_send_in_progress_status function.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-07-12 09:26:42 +02:00
L Lakshmanan
934c6d7b33 drivers: mm: Fix cast warnings on build for RAT
Removed the unneccessary casts in the functions to remove warnings
during build for SoCs using RAT. Functionality reamins the same,
tested on board.

Signed-off-by: L Lakshmanan <l-lakshmanan@ti.com>
2023-07-11 18:20:26 +00:00
Tim Lin
27e2ec8a95 drivers/i2c: Add callback functions to support buffer mode in header file
Add buf_write_received and buf_read_requested callback functions
to support buffer mode.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-07-11 15:50:13 +02:00
David Bongartz
f4aeafd288 drivers: display: add check for set_orientation API implementation
Some drivers do not implement set_orientation().
To prevent crashes, just error out when not implemented.

Fixes: #57277

Signed-off-by: David Bongartz <david.bongartz@gmail.com>
2023-07-11 15:42:34 +02:00
Erwan Gouriou
85aa3e1731 include: dt-bindings: reset: Add bindings for stm32WBA
Add reset bindings for STM32WBA SoCs.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-07-11 15:05:05 +02:00
Guillaume Gautier
daef7c9d1b drivers: clock_control: stm32: Add stm32wba clock control driver
Add clock control driver on STM32WBA.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-07-11 15:05:05 +02:00
Chaitanya Tata
38fc560f21 net: wifi: Introduce Wi-Fi network managers
This introduces support for Wi-Fi network managers in Zephyr. The
motivation is for the Wi-Fi management layer to work with both
Network managers and offloaded Wi-Fi drivers. The device driver
decides which one to use.

network manager : Apps -> Wi-Fi Mgmt -> Network Manager -> Wi-Fi
interface

offloaded       : Apps -> Wi-Fi Mgmt -> Wi-Fi offloaded interface

Support for multiple network managers has been added, each device can
choose its own network manager and there can be mix and match:

  wlan0 - Offloaded
  wlan1 - Network manager 1
  wlan2 - Network manager 2

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2023-07-11 14:55:30 +02:00
Chaitanya Tata
a132487fec net: wifi: Move Wi-Fi ops to a separate struct
Decouple interface and Wi-Fi APIs, Wi-Fi APIs are common independent of
Wi-Fi offload or implemented natively (This is preparation for
introducing Native Wi-Fi).

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2023-07-11 14:55:30 +02:00
Mykola Kvach
634e73dd21 soc: arm64: add PFC files to Renesas r8a77961 Gen3 SoC
Add Pin Function Controller tables of registers and their bits
for ARM64 Renesas R-Car family. With this changes we can use
Renesas PFC driver for configuring bias and driving capabilities.

Add only needed driver strength and bias pins to PFC,
e.g. SDx and UART TX/RX pins.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2023-07-11 11:17:41 +02:00
L Lakshmanan
7fc6e331d8 drivers: mm: Add support for TI RAT module using system_mm API
Added Region based Address Translation (RAT) module driver. Required by
a few Texas Instruments SoCs to fucntion. Uses
sys_mm_drv_page_phys_get() API with device_map() for address translation.

Signed-off-by: L Lakshmanan <l-lakshmanan@ti.com>
2023-07-11 09:44:48 +02:00
Andrei Emeltchenko
c7b5da3326 doc: acpi: Correct ACPI documentation
Correct several typos and make documentation more readable.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-07-11 09:44:07 +02:00
Bill Waters
541482ff20 driver: i2c: infineon: Adding XMC4 I2C driver
- This includes the driver, test app, and sample app
- Only the boards\arm\xmc47_relax_kit board is supported for now

Signed-off-by: Bill Waters <bill.waters@infineon.com>
2023-07-11 09:43:19 +02:00
Ben Marsh
54155df0c8 sys: util: Improve ROUND_UP and ROUND_DOWN macros
Improve utility macros ROUND_UP and ROUND_DOWN to work
with alignments that are not a power of 2.

Signed-off-by: Ben Marsh <ben.marsh@helvar.com>
2023-07-10 18:04:42 +02:00
Harshil Bhatt
8b2a41904d posix: implement timer_getoverrun()
Address missing POSIX function and tests #59956

Signed-off-by: Harshil Bhatt <harshilbhatt2001@gmail.com>
2023-07-10 09:30:33 +02:00
Florian Grandel
4b66680477 net: l2: ieee802154: simplify/fix ACK procedure
Removes redundant ACK state from `struct ieee802154_context` and
simplifies the ACK procedure.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-10 09:29:10 +02:00
Florian Grandel
46d4ee326d net: l2: ieee802154: improve context doc
Improves the documentation of `struct ieee802154_context` members.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-10 09:29:10 +02:00
Florian Grandel
27bfe68204 net: l2: ieee802154: mgmt: improve association procedure spec compliance
This change introduces test coverage for association request and
response. Based on this coverage, several closely related issues were
found in the association process which cannot be split into separate
changes without breaking the build.

Most notably did the associate and disassociate net_mgmt commands send
already encoded IEEE 802.15.4 MPDUs to L3 rather than L2. L3 treated
them as payload and made L2 wrap them with another LL header/footer
which produced invalid packets.

The tests also enforce better aligment of the association process with
the IEEE 802.15.4-2020 standard:

* Association requests now ask for ACK as required by the standard. The
  fake driver was enhanced to produce ACK packages when requested.
* macPanId and macCoordinator* MAC PIB attributes are set in the right
  order for improved filtering of association responses.
* The coordinator may decide not to assign a short address to the end
  device even when associated. This is now supported.
* The coordinator may or may not use a short address. Coordinators
  choosing not to support short addresses are now supported.
* Updating the association will now remove any previously added short
  address from the hardware filter.
* The short address may no longer be changed by the user while
  associated to a PAN. Only the coordinator is allowed to allocate short
  addresses.
* Validation of outgoing and incoming association request/response
  packets is improved.

All changes are documented by pointers into the spec.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-10 09:29:10 +02:00
Florian Grandel
d452ef9863 net: l2: ieee802154: correctly calculate macResponseWaitTime
Calculates macResponseWaitTime and applies it to the association
process.

As the timing calculation re-uses symbol period calculations and other
PHY timing constants previously introduced, these are now shared as
utility functions.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-10 09:29:10 +02:00
Marcin Gasiorek
5894bec82f net: pkt_filter: Introduce additional hooks for pkt_filter
The additional hooks provide infrastructure to construct
rules on another network stack levels. Main benefit of this
approach is packets are pre-parsed and e.g. IP filter is
easier to implement. These hooks are equivalent of prerouting
and local_in in linux's netfilter.

Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
2023-07-10 09:27:47 +02:00
Florian Grandel
5132022a3c kernel: spinlock: add assertion to protect K_SPINLOCK
Adds an assertion for the GCC toolchain to check whether the K_SPINLOCK
block was left without unlocking the spinlock, e.g. by calling break,
return or goto.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-10 09:27:21 +02:00
Florian Grandel
816d09c453 kernel: spinlock: expose LOCKED macro as public API
While the LOCKED pattern is universally useful it can be misused. This
change therefore exposes the LOCKED pattern with extensive usage
documentation to reduce the risk of abuse or unintended deadlock.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-10 09:27:21 +02:00
Florian Grandel
244c33549f kernel: spinlock: remove internal function from docs
Hides a function marked internal from the documentation.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-10 09:27:21 +02:00
Maximilian Deubel
860515a3ad samples: subsys: usb: webusb: Fix Win10 detection
This patch refactors the usage of MS OS 2.0 descriptors in the
WebUSB sample. The function subset header was removed since it
is not allowed for non-composite devices.
Also, a new random GUID was added for automatic driver installation.

Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
2023-07-10 09:26:30 +02:00
Yong Cong Sin
4580708f54 posix: implement uname
Add implementation for posix uname.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-07-09 16:57:16 -04:00
Harshil Bhatt
78c8176c4d posix: Implement pthread_barrieratter functions
Added pthread_barrieratter_init() #59936,
pthread_barrieratter_destroy() #59935,
pthread_barrieratter_getpshared() #59937 and
pthread_barrieratter_setpshared() #59939.

Signed-off-by: Harshil Bhatt <harshilbhatt2001@gmail.com>
2023-07-09 10:40:57 -04:00
Mateusz Kapala
5b44ebe159 bluetooth: host: smp: Add bondable flag overlay per connection
The current API for changing the bondable mode uses the global flag.
With Zephyr support for multiple Bluetooth identities, the API for
changing the bondable mode should be more fine-grained.
The bondable requirements of one identity should not have an impact on
another identity which can have a different set of requirements.
This change introduces function to overlay bondable flag per
connection.

Signed-off-by: Mateusz Kapala <mateusz.kapala@nordicsemi.no>
2023-07-07 14:55:29 +03:00
Carlo Caione
935268ee64 devicetree.h: DT_FOREACH_NODE_VARGS, DT_FOREACH_STATUS_OKAY_NODE_VARGS
Add the _VARGS variant of DT_FOREACH_NODE and
DT_FOREACH_STATUS_OKAY_NODE for when we want to do some kind of
operation on all the nodes in the tree.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-07-07 11:41:19 +02:00
Jordan Yates
5312ebd972 kernel: add k_event_test
Add `k_event_test`, a helper function around `k_event_wait` which is
intended as an equivalent to `atomic_test_bit` in the atomic API.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-07 09:24:25 +02:00
Jordan Yates
4ce1f03aa9 kernel: event modification functions return previous value
Update the return value of functions that modify the internal event
state from `void` to `uint32_t`, so that calling code can determine
whether the event was already in a given state, or if the call modified
it.

This simplifies the usage of `struct k_event` as an alternative to
`atomic_t` that users can block on.

Implements #57216

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-07 09:24:25 +02:00