Commit graph

81057 commits

Author SHA1 Message Date
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
Marcin Gasiorek eb16ab551f tests: net: pkt_filter: Add TCs for new hooks
Add new TCs to cover new hooks functionality.
These tests implement simple IP filter.

Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
2023-07-10 09:27:47 +02:00
Jaroslaw Stelter 0bf467bbcd mm_drv: tlb: Fix context save for remapped pages
In case of remapped reference counter for physical page
is differ to zero, but TLB entry for virtual address equal to
physical address will be disabled. Valid entry will be somewhere
in virtual space where particular physical page is remapped.

Since in adsp_mm_save_context() routine we go through physical
memory range, we need to include these pages in context save loop.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2023-07-10 09:27:31 +02:00
Florian Grandel e256b7d244 kernel: spinlock: LOCKED -> K_SPINLOCK
Let the kernel use the new K_SPINLOCK macro and remove the alias.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-10 09:27:21 +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
Joseph Yates f87a589f5d boards: shields: Adding support for the adafruit can picowbell shield
Adding support for the adafruit can picowbell shield for the
raspberry pi picoi. Also added nodelable for spi0 called 'pico_spi'
as well as an GPIO nexus node 'pico_header'

Signed-off-by: Joseph Yates <joeyatessecond@gmail.com>
2023-07-10 09:26:42 +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
Jamie McCrae fbacedaef8 mgmt: mcumgr: grp: shell_mgmt: Fix issue with unset variable
Fixes an issue where a variable was used without being correctly
set by other parts of the code.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-10 09:26:19 +02:00
Yong Cong Sin 0736448d37 tests: posix: uname: add test
add ztest for uname api

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-07-09 16:57:16 -04:00
Yong Cong Sin 59adf0bb74 samples: posix: add sample for uname
Add a simple, testable sample to print everything in the utsname struct,
and added a `uname` shell cmd basically copied from nuttx just for fun.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-07-09 16:57:16 -04: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
Jakub Duchniewicz adc36315b0 doc: Fix typos in zbus documentation
Fixes a few typos.

Signed-off-by: Jakub Duchniewicz <j.duchniewicz@gmail.com>
2023-07-09 19:58:59 +00:00
Daniel Mangum 43b057a7ce soc: neorv32: Fix spelling in reset.S
Fixes minor misspelling of instruction in the neorv32 reset.S.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2023-07-09 17:50:09 +00:00
Harshil Bhatt 322cd468db docs: update posix docs with pthread_barrierattr
add pthread_barrierattr to supported api list

Signed-off-by: Harshil Bhatt <harshilbhatt2001@gmail.com>
2023-07-09 10:40:57 -04:00
Harshil Bhatt 886325cc1d posix: add tests for pthread_barrierattr
add test coverage for init, destroy, setpshared and getpshared

Signed-off-by: Harshil Bhatt <harshilbhatt2001@gmail.com>
2023-07-09 10:40:57 -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
Christopher Friedt 694cd58647 posix: pthread: fixes for coverity 321140 and 321092
The `pthread_once_lock` `k_mutex` is statically initialized and
only visible within file scope. Coverity identified it as unsafe
because the return values of `pthread_mutex_lock()` and
`pthread_mutex_unlock()` were unchecked. However, if those
functions were to fail here, it would be indicative that
something far worse has happened.

In any case, we add assertions that these functions
succeed rather than silently ignoring with `(void)`, which
ensures that we have coverage when assertions are enabled,
in test, while removing unneeded code with assertions disable,
in production.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-07-09 08:20:32 -04:00
Fabio Baltieri fed377f622 drivers: mipi: delay initialization after display drivers
Currently MIPI devices are set to initialize before display drivers,
which is incoherent with how the mcux mipi-dsi device is declared in the
device tree.

This is detected with build time priority checking:

west build -p -b mimxrt595_evk_cm33 samples/drivers/display \
	     -DCONFIG_CHECK_INIT_PRIORITIES=y

ERROR: /soc/peripheral@50000000/mipi_dsi@31000 POST_KERNEL 40 <
		/soc/peripheral@50000000/lcdif@210000 POST_KERNEL 85

Note that this also changes the priority of dsi_stm32, though that
should be ok since does not appear to have other dependencies in
devicetree.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-08 12:39:53 -04:00
Najumon B.A b4ed6c4300 drivers: serial: driver init level based on parent node
Boot level based on parent node (PCI or no PCI device). Some platforms the
PCI bus driver depends on ACPI sub system to retrieve platform information
such as interrupt routing information. But ACPI sub system currently
support only post kernel and hence such platforms the UART driver instance
init should be invoked only post kernel in case parent node is PCI.

Signed-off-by: Najumon B.A <najumon.ba@intel.com>
2023-07-08 09:00:03 +03:00
Florian Grandel 75c83edc48 dts: ti: cc13xx_cc26xx: devicetree sysclk alignment
This change introduces the "_rtc_timer" suffix for the system tick timer
driver "compatible" property and aligns naming conventions with the
actual CC13/26xx SoC series product policy.

This frees up the "_rtc" namespace to introduce additional APIs based on
the same peripheral in the future (not part of this PR):

rtc: rtc@... {
  compatible = "ti,cc13xx-cc26xx-rtc";
  ...

  timer {
    compatible = "ti,cc13xx-cc26xx-rtc-timer";
    ...
  };

  counter {
    compatible = "ti,cc13xx-cc26xx-rtc-counter";
    ...
  };

  pps {
    compatible = "ti,cc13xx-cc26xx-rtc-pps";
    ...
  };
};

Or alternatively an MFD pattern with similar requirements.

Fixing the namespacing now makes sense standalone as it reduces the
chance of custom drivers being broken in the future.

Redundant extension of the mandatory system clock devicetree node is
replaced with a single `status = "okay"` which seems to be the more
sensible default to avoid user error when defining custom boards.
Knowledgeable users can still override this if really needed.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-07 18:46:24 -04:00
Florian Grandel 38e2eb8fe6 soc: ti: cc13/26xx: clean up include hierarchy
Removes duplicate code and inconsistencies in the naming of the
cc13xx_cc26xx devicetree and RTC driver hierarchy and alignes it with
the actual TI product series naming hierarchy.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-07 18:46:24 -04:00
Greg Ingram e6d463f8dd doc: Updated description grammar in mikro-bus.yaml file
Fixed some wording within the description section

Signed-off-by: Greg Ingram <shaggygi97@gmail.com>
2023-07-07 22:44:36 +00:00
Mariusz Skamra bc710a49f1 Bluetooth: audio: unicast_server: Do not store metadata if rejected
This moves copying of parameters after application return value
validation so that the metadata is not stored if rejected.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-07-07 19:03:55 +00:00
Vinayak Kariappa Chettimada a2ebec5c64 Bluetooth: Controller: Fix coverity issue 318807
[Coverity CID: 318807] Dereference before null check in
subsys/bluetooth/controller/ll_sw/ull_iso.c

Fixes #59514.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-07-07 19:01:04 +00:00
Kevin Townsend 5f0bba7ced maintainers: Change TF-M maintainer to d3zd3z
TF-M will be maintained by d3zd3z moving forward. This PR also includes
some cleanup to the collaborator list of subsystems and modules related
to TF-M.

Signed-off-by: Kevin Townsend <kevin.townsend@linaro.org>
2023-07-07 16:21:04 +02:00
Emil Gydesen 275c86d399 Bluetooth: BAP: Shell: Merge the unicast and broadcast stream structs
Merging the two structs cleans up significant amount of code
and makes it easier to expand later.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-07-07 14:53:24 +02:00
Emil Gydesen d17cde46d1 Bluetooth: BAP: Shell: Improve handling of PSN when sending
Previously the calculation of the PSN was done using
just a timer. This would not work correctly when
attempting to send multiple packets in a single SDU
interval (e.g. to enqueue 2 or more).

Previously we only ever attempted to send 1 packet in
the `sent` callback but scheduling the work item. However
in the case that the `sent` callback was called twice
before the work item had been triggered (possible due
to the priority of the RX thread being higher than the
system workqueue thread). This has been modified so that
if we can enqueue more packets in the lc3_audio_send_data
function, we re-enqueue the work item. We re-enqueue rather
than sending multiple in a single call to avoid blocking
other items on the system workqueue from being scheduled.
This could cause possible missed intervals (if other workqueue
items are processed), but it should be OK from a ISO perspective,
and the new PSN calculator handles this much better.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-07-07 14:53:24 +02:00
Emil Gydesen 06dc36d268 Bluetooth: BAP: Shell: Fix formatting in lc3_audio_send_data
Some formatting was not compliant with the coding style.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-07-07 14:53:24 +02:00
Emil Gydesen d02a215a14 Bluetooth: BAP: Shell: Add support for TX retry when sending sine
Modify lc3_audio_send_data to be triggered on a delayable
k_work so that we can retry it with a delay if it fails for whatever
reason.

This also moves the calculation of the seq_num closer
to when it is used, which makes sense as it is based on
a timed calculation.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-07-07 14:53:24 +02:00
Alberto Escolar Piedras 8252e99608 drivers: entropy native: Refactor to support embedded libCs
Refactor the host libC accesses to use the native simulator
host trampolines.

In this way we support building this driver with embedded libCs.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-07-07 14:32:41 +02:00
Alberto Escolar Piedras 265010a4b6 native boards: Make native simulator host trampolines avaliable to all
To ease writing common drivers, let's make the host trampolines
from the native simulator avaliable to all posix based boards.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-07-07 14:32:41 +02:00
Alberto Escolar Piedras e9721db183 native_simulator: Align with upstream latest with more trampolines
Upstream SHA: be3eac6931b49291e51da5d5aa1a99ab58f81541

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-07-07 14:32:41 +02:00
Andrzej Kuros abd90085ac soc: arm: nrf53: workaround pop lr after wfi crash
On nRF5340 net core it was observed that when `wfi` instruction was
followed by `pop {r0, lr}` in the `arch_cpu_idle` function,
the value of `lr` sometimes got read as 0 from memory despite
having correct value stored in the memory.

This commit inserts additional `nop` instruction after waking up
to delay access to the memory.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
2023-07-07 14:32:27 +02:00
Mateusz Kapala 8e5673ccd1 bluetooth: tests: Add bsim test for setting bondable flag per-conn
Added test for the bt_conn_set_bondable API function.
Check if we can pair without setting the bonding flag on the
per-connection basis if the device was already bonded on the
other identity.

Signed-off-by: Mateusz Kapala <mateusz.kapala@nordicsemi.no>
2023-07-07 14:55:29 +03: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
Armin Brauns b95cdb2a33 drivers: serial: stm32: add support for RS485 configuration
The stm32 UART can output a "driver enable" signal on the RTS pin that
allows controlling e.g. external RS-485 drivers.

This can already be configured through the devicetree using the `de-*`
properties, but not through uart_configure(). This commit enables the use
of .flow_ctrl=UART_CFG_FLOW_CTRL_RS485.

This is supported on all devices other than l1, f1, f2, and f4 as found by
this search:

$ grep -rLw USART_CR3_DEM ../modules/hal/stm32/stm32cube/*/soc/*.h |\
    grep -vE 'system_|partition_|stm32[^0-9]+[0-9]?xx\.h' |\
    cut -d/ -f6 |\
    sort -u

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-07-07 13:16:27 +02:00
Marcin Niestroj 652d9a5b0a boards: nucleo_l476rg: add ST Morpho connector nexus node
Add a new GPIO nexus node for the ST Morpho connector in the board.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-07-07 13:16:10 +02:00
Marcin Niestroj 17ef81c60e boards: nucleo_l452re: add ST Morpho connector nexus node
Add a new GPIO nexus node for the ST Morpho connector in the board.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-07-07 13:16:10 +02:00
Marcin Niestroj be6853d9cc boards: nucleo_l152re: add ST Morpho connector nexus node
Add a new GPIO nexus node for the ST Morpho connector in the board.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-07-07 13:16:10 +02:00
Marcin Niestroj 4c87e60005 boards: nucleo_l073rz: add ST Morpho connector nexus node
Add a new GPIO nexus node for the ST Morpho connector in the board.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-07-07 13:16:10 +02:00
Marcin Niestroj e6a51a9219 boards: nucleo_l053r8: add ST Morpho connector nexus node
Add a new GPIO nexus node for the ST Morpho connector in the board.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-07-07 13:16:10 +02:00
Marcin Niestroj a6c4d7f919 boards: nucleo_f446re: add ST Morpho connector nexus node
Add a new GPIO nexus node for the ST Morpho connector in the board.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-07-07 13:16:10 +02:00
Marcin Niestroj 5499a3102e boards: nucleo_f411re: add ST Morpho connector nexus node
Add a new GPIO nexus node for the ST Morpho connector in the board.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-07-07 13:16:10 +02:00
Marcin Niestroj 55c54bd421 boards: nucleo_f410rb: add ST Morpho connector nexus node
Add a new GPIO nexus node for the ST Morpho connector in the board.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-07-07 13:16:10 +02:00
Marcin Niestroj e6960ea010 boards: nucleo_f401re: add ST Morpho connector nexus node
Add a new GPIO nexus node for the ST Morpho connector in the board.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-07-07 13:16:10 +02:00
Marcin Niestroj 1ac72b3093 boards: nucleo_f334r8: add ST Morpho connector nexus node
Add a new GPIO nexus node for the ST Morpho connector in the board.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-07-07 13:16:10 +02:00
Marcin Niestroj d3220277c9 boards: nucleo_f303re: add ST Morpho connector nexus node
Add a new GPIO nexus node for the ST Morpho connector in the board.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-07-07 13:16:10 +02:00
Marcin Niestroj bb80d85b1b boards: nucleo_f103rb: add ST Morpho connector nexus node
Add a new GPIO nexus node for the ST Morpho connector in the board.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-07-07 13:16:10 +02:00