Commit graph

15409 commits

Author SHA1 Message Date
Lucas Denefle
a5e5c1d00a drivers: cellular: add ldenefle to copyright
Add Lucas Denefle to copyright of the cellular API.

Signed-off-by: Lucas Denefle <lucas.denefle@converge.io>
2023-12-19 22:51:17 +00:00
Andrei Emeltchenko
28ac21330d lib: acpi: Implement acpi_dmar_ioapic_get()
Implement get IOAPIC id from DMAR table.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-19 11:04:19 +01:00
Andrei Emeltchenko
4c3eda827a acpi: Add acpi_dmar_foreach helpers
Add function walking though all DMAR subtables, at the moment only
first subtable is taking into account, which causes bugs for some
boards.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-12-19 11:04:19 +01:00
Emil Gydesen
cda5e58aa5 Bluetooth: CAP: Commander discovery support
Implement the CAP Commander discovery function.

Adds support for it in the shell.

This includes initial babblesim and unit testing as well.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-12-19 08:50:40 +01:00
Daniel Leung
dab6f665ca xtensa: fix build errors with cache functions
() arch_icache_line_size_get() needs to be inlined or else
   compiler would complain that it is not being used.
() arch_icache_flush_all() returns -ENOTSUP not as there is
   no xthal_icache_all_writeback() in HAL.
() Fix typo vid -> void in arch_icache_disable().

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-18 12:25:04 +01:00
Marek Vedral
93a4287115 arm: debug: Add GDB stub for aarch32
This commit adds implementation of GDB stub for 32-bit ARM. It has been
tested only on the Zynq-7000 SoC and I would like to get any feedback
from others.

The stub still has these issues:

- To implement single stepping, it uses instruction address mismatch
  breakpoint, as recommended in ARMv7 reference. The breakpoint control
  register is configured (the state control fields) for the "PL0,
  Supervisor and System modes only" option. Otherwise the breakpoint
  would also halt the processor in abort mode, in which the stub loop
  runs. Zephyr kernel runs in the system mode. This works well until the
  kernel enables interrupts, as interrupt handlers typically run in
  Supervisor mode. Single stepping therefore sometimes "catches" a
  handler instead of the next application instruction. I have not tried
  User mode, because Cortex-A SoCs do not appear to have the
  ARCH_HAS_USERSPACE flag.

Cc: Michal Sojka <michal.sojka@cvut.cz>
Signed-off-by: Marek Vedral <marek.vedral@gmail.com>
2023-12-18 09:31:42 +01:00
Ian Morris
26577a18b0 dt-bindings: pinctrl: renesas: fix r7fa4m1 pin config numbering
Pin configuration value generated by RA_PINCFG_xxx macro is incorrect if
pin number is greater than 9 due to a mistake in the pin numbering.

Signed-off-by: Ian Morris <ian.d.morris@outlook.com>
2023-12-18 09:30:19 +01:00
Tom Chang
4dc7c89f40 drivers: espi: npcx: introduce espi taf driver
This CL implements espi taf read/write/erase function for NPCX.

Signed-off-by: Tom Chang <CHChang19@nuvoton.com>
2023-12-18 09:30:01 +01:00
Pavel Vasilyev
fe70e50d41 Bluetooth: Mesh: Added support for randomly delaying publications
The section 3.7.3.1 of the mesh specification recommends to delay
a message publication in certain cases:
- at power-up or upon state change for a time between 20 to 500 ms
- for periodic publications for a time between 20 to 50 ms

This change implements this recommendation by adding the
`CONFIG_BT_MESH_DELAYABLE_PUBLICATION` Kconfig option which enables
the randomization code and by adding the `bt_mesh_model_pub.delayable`
bit field which allows each model decide whether the publications
should be delayed for this model or not.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-12-18 09:29:24 +01:00
Pieter De Gendt
4807ada01e net: lib: coap: Use coap_transmission_parameters in coap_server
Update coap_service_send and coap_resource_send to take an optional
pointer argument to the newly introduced coap_transmission_parameters.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-12-18 09:28:25 +01:00
Peter Mitsis
ee977dee47 kernel: Remove obsolete _mailbox field
Removes the _mailbox from the k_mbox_msg structure. This field
is not used and only existed for legacy API support while Zephyr
was transitioning from the split microkernel/nanokernel to the
current unified kernel design.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-12-17 20:28:44 -05:00
Peter Mitsis
4b2bf5abcc kernel: Apply const to k_pipe_put() parameter
The pointer parameter 'data' in the function 'k_pipe_put()' ought to
use the const modifier as the contents of the buffer to which it
points never change. Internally, that const modifier is dropped as
both 'k_pipe_get()' and 'k_pipe_put()' share common code for copying
data; however 'k_pipe_put()' never takes a path that modifies those
contents.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-12-15 14:51:35 -05:00
Jonathan Rico
a05a47573a Bluetooth: ATT: Internalize ATT PDU TX pool
Why?
- metadata is easier to manage as an array + index
  - less error-prone -> less memory-management bugs
- we can. because of the previous refactor
- PDU allocations are more predictable
- ATT buffer size can be optimized by app
- isolates ATT from the rest of the ACL users
  - decouples ATT PDU size from e.g. SMP w/ LESC

Drawbacks:
- higher memory usage
- kconfig change

The higher memory use is only temporary, as this will be followed-up
with more refactors that should bring it back down.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Co-authored-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-12-15 17:14:56 +02:00
Simon Hein
47ec4359b9 doc: Clean up wrong c function links
Resolve wrong documentation c function links for
irq: z_shared_isr, rtio: rtio_cqe_get_mempool_buffer
and sensor: sensor_read

Signed-off-by: Simon Hein <Shein@baumer.com>
2023-12-15 08:51:34 -06:00
Tomasz Moń
d76934daeb dt-bindings: usb: initial USB Audio Class 2 support
USB Audio Class 2 (UAC2) includes a method to describe audio device
topology to host using a set of class specific descriptors. The audio
device description includes complete sample clock topology and audio
processing organization.

Zephyr specific bindings are supposed to allow user to create reasonably
simple audio device description using devicetree syntax. The bindings
currently include only the absolute minimum set required for headset
example. Bindings for other entities (Clock Selector, Clock Multiplier,
Mixer Unit, Selector Unit, Feature Unit, Sample Rate Converter,
variuos Effect Units, various Processing Units, Extension Unit) can be
added later together with the actual USB class implementation.

The main idea is that user does create one zephyr,uac2 compatible node
for every USB Audio 2 class instance. Note that in majority of cases
just one USB Audio 2 class is necessary because the number of streaming
interfaces is virtually unlimited (USB Audio 2 class can have up to 255
entities). The zephyr,uac2 node includes child nodes with compatibles
set to desired entity or audiostreaming interface. The parent-child
relationship is necessary to allow grouping entities to correct audio
class instance.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-12-15 14:24:44 +01:00
Jamie McCrae
a48a594f13 mgmt: mcumgr: callback: Add op to receive callback
Adds the operation supplied by the client to the MCUmgr command
received callback

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2023-12-15 11:48:59 +00:00
Juha Ylinen
d09d3d82ef net: lib: coap: Change coap_pending_init()
Replace function parameter 'retries' with pointer to structure
holding coap transmission parameters. This allows setting the
retransmission parameters individually for each pending request.

Add coap transmission parameters to coap_pending structure.

Update migration guide and release notes.

Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
2023-12-15 11:41:27 +00:00
Rubin Gerritsen
dc9ad42ffb Bluetooth: Clarify when the sent callback is issued
The timing of the sent callback shouldn't be used to determine
when something is sent on air. The callback is issued after the
controller has raised the HCI event "Number Of Completed Packets".
The timing of this event is dependent on the implementation.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2023-12-15 11:41:14 +00:00
Luca Burelli
4d86162989 llext: merge llext_mem and llext_section enums
The only difference in the two enums are some entries related to
relocation sections. However, these entries are not used in the
code, so they can be safely removed, along with the mapping function.

Use LLEXT_MEM_* to avoid confusion with low-level "section" names.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2023-12-14 19:06:55 +00:00
Jukka Rissanen
b6aea97dc7 net: l2: dummy: Add start/stop API functions
The dummy L2 layer does not implement any L2 functionality
but it does not mean that it should not implement start/stop
functions that are called when the related network interface
is brought up or taken down.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-14 14:21:31 +01:00
Jukka Rissanen
af0336ed19 net: socket: Remove "ignored" comment from supported symbols
Some socket symbols were marked as "ignored" even when they
are in fact supported.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-14 10:14:50 +01:00
Jukka Rissanen
43c1b8917f net: socket: Add missing doxygen documentation
Add doxygen comments to those APIs where they were missing
and were relevant.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-14 10:14:50 +01:00
Jukka Rissanen
124f874bed net: socket: Update socket option documentation
Remove redundant information from socket option documentation.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-14 10:14:50 +01:00
Jukka Rissanen
bbd029a087 net: socket: TLS doc group was missing defines
Couple of TLS defines were not in correct documentation group.
Add also missing doxygen comments for TLS defines.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-14 10:14:50 +01:00
Jukka Rissanen
c6b6f74510 net: socket: Group various defines together for documentation
Groupped various defines in socket.h together based on their
usage. This groupping is only for documentation.

Fixes #66081

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-14 10:14:50 +01:00
Christopher Friedt
04c9903055 posix: pthread_once: simplify and reduce size of pthread_once_t
Since pthread_once() is both the initializer and executor of
pthread_once_t, it can have maximally two states. Since the
implementation in Zephyr previously aimed to maximize libc
compatibility, we opted to use the definition of pthread_once_t
from newlib, which is a structure with two ints.

It does not make sense to use 64 bits to manage 2 possible
states. The control for that should effectively be a bool.

We maintain compatibility with newlib by asserting (at build
time), that newlib's pthread_once_t is larger than Zephyr's
new struct pthread_once (which just contains a bool).

This allows us to delete the non-standard pthread_key.h
header file (finally).

Reuse the pthread_pool_lock in order to synchronize the related
init function (so that it is only called maximally once from any
thread). The spinlock is only used to test the state and the
init function is not called with the spinlock held.

The alternative was to use an atomic inside of
struct pthread_once. But again, that could be up to 64-bits with
Zephyr's atomics implementation.

Ideally we would use C11 generics or something to support atomics
on 8, 16, 32, and 64-bit primitives.

Lastly, also update declarations for C11 threads as they mostly
mirror our pthread implementation.

This needed to be done as a single commit in order to ensure
continuity of build.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-12-14 09:32:58 +01:00
Declan Snyder
1011acd4d7 drivers: nxp_enet: Improve code readability
Improve code readability of this driver by simplifying and reworking
some of the source code, formatting and comments.
This commit is not meant to cause any functional difference.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-12-14 09:30:05 +01:00
Declan Snyder
e913ccc753 net: Add Kconfig for net buf alignment
Add a NET_BUF_ALIGNMENT kconfig to make net buffer alignment configurable.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-12-14 09:29:47 +01:00
Armando Visconti
1badec4bfd drivers/sensor: add support to LIS2DU12 accelerometer
The LIS2DU12 is a linear 3-axis accelerometer with advanced digital
functions whose MEMS and ASIC have been expressly designed to build
an outstanding ultralow-power architecture in which the anti-aliasing
filter operates with a current consumption among the lowest in the
market.
This driver is based on stmemsc HAL i/f v2.3

https://www.st.com/en/datasheet/lis2du12.pdf

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-12-14 09:28:52 +01:00
Jukka Rissanen
37c18ddcb1 net: if: Init also dhcpv6 when interface is init
Do dhcpv6 state initialization same way as how dhcpv4 is done
when initializing network interface structure.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-13 20:13:31 +01:00
Jukka Rissanen
f4974ca82a net: if: Cleanup network interface init macros
Avoid using #ifdefs when declaring macros twice. This way
there is only one macro that does the initialization.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-13 20:13:31 +01:00
Jukka Rissanen
9bc2815c59 net: buf: Define only one pool initializer macro
Use the IF_ENABLED() macro to define the net_buf pool initializer
macro only once. This way the initializer is only defined in
one place.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-13 20:13:24 +01:00
Johann Fischer
52686a8308 usb: device_next: simplify way to set/change triple code
Usually we want set all values of code triple Base Class, SubClass, and
Protocol at once. Merge existing functions to set code, subcode,
protocol into just one helper to set code triple.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-12-13 17:52:00 +01:00
Jędrzej Ciupis
7afeb62e20 drivers: ieee802154: support Key Identifier Mode > 1
IEEE 802.15.4-2020 defines four possible values for Key Identifier Mode
field of the Auxiliary Security Header. The current ieee802154 driver
API only supports two of them: b00 and b01. This commit adds support for
the two remaining Key Identifier Mode values. It's done by replacing a
field that can only hold Key Index into a field that can holds a pointer
to the entire Key Identifier field.

See IEEE 802.15.4-2020, sections 9.4.2.3 and 9.4.4 for further reference.

Signed-off-by: Jędrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2023-12-13 13:57:24 +01:00
Kevin ORourke
fbfd36e81e drivers: clock_control: stm32: Add HSE CSS support
Add support for enabling the clock security system, which can detect
failures of the HSE clock.

Includes tests for nucleo_h743zi and nucleo_g474re.

Signed-off-by: Kevin ORourke <kevin.orourke@ferroamp.se>
2023-12-13 13:56:43 +01:00
Daniel Leung
a819bfb2d5 xtensa: rename z_xtensa to simply xtensa
Rename the remaining z_xtensa stuff as these are (mostly)
under arch/xtensa.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-13 09:41:24 +01:00
Daniel Leung
6d5e0c25a6 xtensa: rename z_xtensa_irq to simple xtensa_irq
This gets rid of the z_ prefix.

Note that z_xt_*() are being used by the HAL so they cannot be
renamed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-13 09:41:24 +01:00
Daniel Leung
8bf20ee975 xtensa: mmu: rename prefix z_xtensa to xtensa_mmu
This follows the idea to remove any z_ prefix. Since MMU has
a large number of these, separate out these changes into one
commit to ease review effort.

Since these are no longer have z_, these need proper doxygen
doc. So add them too.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-13 09:41:24 +01:00
Daniel Leung
004e68ccea xtensa: move exception handling func to arch internal header
z_xtensa_dump_stack() and z_xtensa_exccause() are both arch
internal functions that should not be exposed in public API.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-13 09:41:24 +01:00
Daniel Leung
3af390f6ed xtensa: doxygen: add groups for public and internal APIs
This adds two groups for Xtensa public and internal APIs.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-13 09:41:24 +01:00
Anas Nashif
e29452da64 arch: arm: remove aarch32 from include header guards
We follow the path of the header to define the guard, aarch32 was
removed some time ago and the guards still had AARCH32 in them, just
remove it and keep the guard consistent and short.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-12 18:47:57 +00:00
Daniel Leung
c6773403b1 kernel: mm: fix some doxygen issues
Fix misplaced in,out in @param. If any parameters are output,
mark the others as input for clarity.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-12 18:46:21 +00:00
Daniel Leung
6421c7a5fe os: timing: polish doxygen
() Moves the architecture specific timing measurement APIs
   under the timing measurement APIs group.
() Add SoC and board specific API groups.
() Document each SoC and board specific API so the doc shows up
   for them.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-12 19:10:33 +01:00
Lucas Denefle
d1ba79a070 drivers: cellular: add signal and modem_info API
Implement modem info pulling using the init and periodic chat scripts

Signed-off-by: Lucas Denefle <lucas.denefle@converge.io>
2023-12-12 19:09:33 +01:00
Bjarki Arge Andreasen
ad011695ab drivers: Add cellular API for network configuration
Adds two APIs which allow for configuring the cellular
network configuration of a cellular network device. like
a cellular modem. The first allows for configuring which
access technology to use, and optionally, which bands to
use. The second allows for getting all supported access
technologies are supported, and which bands for each tech
are supported.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-12-12 19:09:33 +01:00
Ricardo Rivera-Matos
d4ed6bacf0 drivers: charger: Adds charge_enable handler
Adds a charge_enable handler to facilitate enabling and disabling
a charge cycle. This deprecates enabling and disable the charge
cycle via the CHARGER_PROP_STATUS property.

Signed-off-by: Ricardo Rivera-Matos <ricardo.rivera-matos@cirrus.com>
2023-12-12 10:49:39 -06:00
Jamie McCrae
2522a78566 linker: Add flash end ROM offset
Reduces the size of an image in the linker script by using the
ROM end offset Kconfig value

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-12-12 15:31:16 +01:00
Johann Fischer
6a7f43b47b usb: device_next: add SetFeature(TEST_MODE) support
Add an interface to verify and enable a test mode. The test mode
selected in the SetFeature control request must be verified to be
supported by the controller and enabled after the status stage is
completed.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-12-12 15:01:49 +01:00
Johann Fischer
7013b4d7c7 usb: device_next: add support to set device address directly
Not all device controllers expect the device address to be set after the
status stage. Add support to directly set a new device address without
waiting for the control request status stage.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-12-12 15:01:49 +01:00
Flavio Ceolin
7382d7052b xtensa: mmu: Fix partition permission
The ring field in the pte mapping a memory partition should
be based in the partition attribute and not in the domain
asid that is used only to set the ASID (in RASID) position for
user ring.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-12-12 10:57:57 +01:00