Commit Graph

74361 Commits

Author SHA1 Message Date
Chris Friedt 92fdcaf18c posix: define struct linger in sys/socket.h
The spec requires `<sys/socket.h>` to declare
struct linger. Define it so that applications
and libraries do not get compile errors when
building against Zephyr.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-23 09:57:31 -08:00
Chris Friedt 2e64f3b48c posix: ioctl: define FIONREAD as some applications require it
The `FIONREAD` ioctl is usually used to query how many bytes
are available to read immediately from a specific file
descriptor. It's quite useful.

Define it here so that it can be used by applications.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-23 09:57:31 -08:00
Chris Friedt d5d890ee24 posix: netdb: ensure that EAI constants are defined
Constants like `EAI_SYSTEM` should be defined in `<netdb.h>`
according to the spec.

In Zephyr, they should be defined via appropriately
namespaced z-variants (currently `DNS_EAI_SYSTEM` and so on).

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-23 09:57:31 -08:00
Chris Friedt ffe2fba4f1 posix: ensure in_addr_t and in_port_t defined via arpa/inet.h
The spec requires that `in_addr_t` and `in_port_t` are both
defined when `<arpa/inet.h>` is included.

They were added to `<netinet/in.h>` in the previous commit.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-23 09:57:31 -08:00
Chris Friedt 5a4ec84df4 posix: define in_port_t and in_addr_t in netinet/in.h
The spec requires that these two types be defined in
`<netinet/in.h>`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-23 09:57:31 -08:00
Chris Friedt a16c7eda3f posix: ioctl: actually declare a function prototype
The `<sys/ioctl.h>` header never actually declared
the `ioctl(2)` function prototype, so this fixes that.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-23 09:57:31 -08:00
Chris Friedt ed11614a87 posix: mqueue: do not typedef mq_attr
The specification actually requires this to be a plain
`struct mq_attr`, without the typedef.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-23 09:57:31 -08:00
Chris Friedt 24cfb89753 posix: avoid redefinition errors in network and posix headers
The networking subsystem defines a rather large amount of POSIX
prototypes. However, it's done in a somewhat subversive way via

```
CONFIG_NET_SOCKETS_POSIX_NAMES
```

This option should be removed (or moved to POSIX) and the
networking implementations should be properly namespaced.

With that, the POSIX interface for network-related functions
can simply be a thin wrapper around the z-namespaced variants,
where applicable, or proper POSIX functions should actually
be moved to `lib/posix`.

This will also require a better solution to testing network
functionality on `native_posix` though. The ability to run
those tests and the supposed incompatibility between
`CONFIG_ARCH_POSIX` and `CONFIG_POSIX_API` was the main
motivation for adding `CONFIG_NET_SOCKETS_POSIX_NAMES`.

Eventually, with proper namespacing, these preprocessor
guards against redefining the same symbols can be
removed.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-23 09:57:31 -08:00
Chris Friedt b824039e98 posix: unistd.h: add declaration for _exit()
The `_exit()` function should be declared in `<unistd.h>`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-23 09:57:31 -08:00
Chris Friedt 3aff1ff0c2 posix: fs: avoid adding open() alias with newlib and picolibc
Newlib and PicoLibc both already alias `open` to `_open`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-23 09:57:31 -08:00
Chris Friedt e431cfbbe5 posix: eventfd: select eventfd by default with CONFIG_POSIX_API
Although the eventfd API is not (yet) a part of POSIX,
it's pretty well ubiquitous on POSIX systems now.

Enable it by default when `CONFIG_POSIX_API=y`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-23 09:57:31 -08:00
Chris Friedt bf5d47a5ce posix: getopt: select getopt by default with CONFIG_POSIX_API
The `getopt()` function is part of POSIX and should be
available when applications choose to enable general POSIX
API support.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-23 09:57:31 -08:00
Chris Friedt 8b0f7b3e36 posix: treat pthread_key.h as an implementation detail
The `pthread_key.h` header is nonstandard and is an
implementation detail of `pthread.h`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-23 09:57:31 -08:00
Chris Friedt e93f3c9b6d posix: rename posix_sched.h to sched.h
Rename the `posix_sched.h` to conform to the spec.

IEEE Std 1003.1

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-23 09:57:31 -08:00
Chris Friedt 43110ddb71 lib: posix: standard include paths with CONFIG_POSIX_API
With the `<zephyr/posix/...> prefix, it became
exponentially more difficult to integrate 3rd-party
libraries that depend on the POSIX API.

Standard POSIX headers should be available in standard
include paths - and that should most certainly the case
when `CONFIG_POSIX_API=y`.

With this change:

* When `CONFIG_POSIX_API=y`
  - applications have explicitly chosen to use
    POSIX APIs.
  - all standard POSIX includes are in the default
    include path.
* When `CONFIG_POSIX_API=n`
  - applications *may* include POSIX headers
    explicitly with the namespaced prefix
  - e.g. `#include <zephyr/posix/unistd.h>`
  - individual Kconfig options can be used to
    enable POSIX features selectively, such as
    `getopt` or `eventfd`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-23 09:57:31 -08:00
Gerson Fernando Budke 97967f0526 drivers: ieee802154: rf2xx: Fix hang on 0x2c isr_status
When transceiver is overload on reception a frame can be stored on
the internal buffer without processing a frame start interrupt. The
frame will complete and system will received a interrupt and signal
receiver thread with an isr_status equal to 0x2c.

The current implementation process one flag at time and it may hang
when status is 0x2c. This issue can be reproduced using two nodes
where one perform a regular TX broadcast and tThe other one should
be wait for frames. The receptor should run on debug mode and system
should be started normally. The problem happens when pressing CTRL+C
on the debugger, which will cause system to stop. However, the
transceiver still can receive one last frame. After a few transmission
user can continue application and a isr_status of 0x2c will be visible
if CONFIG_IEEE802154_DRIVER_LOG_DEBUG is enabled.

This fixes the current issue by processing all RF2XX_TRX_END events.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-01-23 09:33:53 -08:00
Marti Bolivar c4b10874eb doc: dts: add missing entry to dts/bindings search path
Since SHIELD_DIRS gets added to DTS_ROOT in dts.cmake, any shield
directories are also places where we look for bindings by default.
This feature is not used in upstream Zephyr, but it is supported,
so document it.

Suggested-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-01-23 07:16:04 -08:00
Marti Bolivar 196df5c9b4 doc: dts: clarify reg format
These are in hex.

Suggested-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-01-23 07:16:04 -08:00
Marti Bolivar 7812bedb09 doc: dts: touch up api
Just a few minor things from a periodic review.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-01-23 07:16:04 -08:00
Marti Bolivar c35d83f95d doc: dts: touch up api-usage
Just a few minor things from a periodic review.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-01-23 07:16:04 -08:00
Marti Bolivar 1ab3a6f53d doc: dts: document zephyr, prefix for props/compats
We have established a convention that the zephyr, prefix in property
names indicates some sort of zephyr-specific extension to a common
binding, or a zephyr-specific driver configuration knob. We also have
established a convention that compatibles which begin with "zephyr,"
are specific to our operating system. Document these facts.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-01-23 07:16:04 -08:00
Marti Bolivar 0d827a8f50 doc: dts: improve bindings-upstream
Splitting up the 'general rules' section into subsections makes it
possible to link directly to a particular rule. This is useful when
pointing out an issue during code review, sharing with another
colleague, etc. Adding a local table of contents makes the page
skimmable (it's buried too deeply in the toctree to have sections
listed in the HTML sidebar).

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-01-23 07:16:04 -08:00
Marti Bolivar cd3008a9ac doc: dts: improve zephyr-user-node.rst
Now that this information is in a separate page instead of buried at
the bottom of the DT bindings documentation, it's more convenient to
split it up into subsections for readability.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-01-23 07:16:04 -08:00
Marti Bolivar 67b0cd382e doc: dts: clarify a design requirement
There's been some confusion about what we mean by hardware
description. We're really talking about the user-facing inputs that
need to be configured per SoC, application, etc. It's fine to do
things like use ifdeffery on a CMSIS header in an aarch32 support file
to decide if the current target has some feature, for instance -- that
sort of thing doesn't *have* to come from DT.

At the same time, we don't want to encourage vendor-specific hardware
configuration languages from creeping into upstream zephyr, so keep
the language strong in an effort to avoid that misinterpretation.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-01-23 07:16:04 -08:00
Marti Bolivar b141c72a2a doc: dts: add guide to phandles
Phandles, specifier spaces, and cell names are simultaneously
extremely common and woefully underdocumented. Address that by:

- reworking our existing documentation on these subjects in
  bindings-syntax.rst, fixing missing information in the
  property syntax template as well

- adding a standalone guide which describes how all the pieces
  fit together, providing a bridge for the gap between
  DTS/bindings and C APIs

My goal is not to eventually make this a comprehensive place
where *all* specifier spaces are documented. It would be better (more
scalable, more discoverable) to improve the individual API pages to
cover the devicetree-related conventions that apply in each case.
That's a problem for someone else and another day, but we do need a
few concrete references in the DTS guides to keep the motivation
clear.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-01-23 07:16:04 -08:00
Marti Bolivar 6780ed4a82 doc: dts: split up intro
The devicetree introduction page is too big. Split it up to improve
readability and restore maintainability. Add more section headers and
do some other rearranging now that it's more convenient to do so.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-01-23 07:16:04 -08:00
Marti Bolivar aeabe31c60 doc: dts: bindings-syntax improvements
Generic improvements:

- clean up some language that needs adjusting
- rename some section headers and reorder some content to
  improve readability
- add a table of contents to ease search

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-01-23 07:16:04 -08:00
Marti Bolivar eb21bd36eb doc: dts: split up bindings docs
The bindings.rst page has gotten too big. Split it up into
sub-documents to improve readability and restore maintainability.

As part of this effort, move the /zephyr,user node documentation into
its own page in the guide. This page has proven extremely difficult
for users to spot in my experience, and it's meant as a convenience,
so let's make the documentation more convenient as well.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-01-23 07:16:04 -08:00
Francois Ramu e9f77f1ecf samples: drivers: use stm32 dma driver binding macro to configure channel
Use the macro as defined by the
include/zephyr/dt-bindings/dma/stm32_dma.h to configure the
dma channel.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-23 09:15:21 -06:00
Francois Ramu 6ff19d77ce tests: drivers: use stm32 dma driver binding macro to configure channel
Use the macro as defined by the
include/zephyr/dt-bindings/dma/stm32_dma.h to configure the
dma channel.
Use the STM32_DMA_PERIPH_TX or STM32_DMA_PERIPH_RX value.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-23 09:15:21 -06:00
Francois Ramu 0470396e0c dts: arm: stm32 devices include the dma definitions for driver
Include the bindings macro to help configuring the dma channels
of a stm32 peripheral

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-23 09:15:21 -06:00
Francois Ramu 48d4e017bd include: bindings: dma macro definition for stm32 dma driver config
Defines DMA macro to help channel configuration and feature for the stm32
devices. Add one default value for most of the usecases
of peripheral DMA settings.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-23 09:15:21 -06:00
Vinayak Kariappa Chettimada 02ee85c893 Bluetooth: Controller: FIXME comment for chain PDU time reservation
Add FIXME comments to handle additional time reservations
required for advertising auxiliary channel chain PDUs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-23 13:08:34 +01:00
Julien D'Ascenzio 740f915721 nvs: use CRC8 if cache size is 256
When cache size is 256, we can use CRC8

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2023-01-23 12:04:55 +00:00
Andrei Emeltchenko 270668b752 bluetooth: controller: Prevent Out of band access
Add check preventing Out of band access. There are tests trying to
access out of band handle like:

test_sink_invalid_ref and test_source_invalid_ref trying to access
handle 99.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-23 12:04:25 +00:00
Wojciech Slenska bf2c489a96 boards: arm: b_u585i_iot02a: Enable aes
Activate the AES node in the b_u585i_iot02a board.

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2023-01-23 12:04:00 +00:00
Wojciech Slenska 37f15d2b96 dts: arm: stm32u5: Add aes node
Add hw crypto support in stm32u5 dtsi.

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2023-01-23 12:04:00 +00:00
Emil Gydesen 4a0d9d10e8 Bluetooth: Audio: Add missing audio metadata
Adds the BT_AUDIO_METADATA_TYPE_AUDIO_STATE and
BT_AUDIO_METADATA_TYPE_BROADCAST_IMMEDIATE metadata types from
the LE Audio assigned numbers document.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-01-23 12:03:24 +00:00
Andrei Emeltchenko 02fa6ba7e6 bluetooth: shell: Correct ad_len type
Fixes warning when comparing that size_t is negative.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-23 13:26:59 +02:00
Gerson Fernando Budke eb9460ce5e mgmt: updatehub: Add no memory check at cmd_info
The updatehub shell cmd_info allocate memory but not checks function
return. This add missing checks and proper error handle.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2023-01-23 10:24:07 +00:00
Gerson Fernando Budke 647c48c574 mgmt: updatehub: Add userspace syscalls
The current updatehub version forces user application to run in kernel
mode. This add necessary api syscalls to isolate userspace from kernel.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2023-01-23 10:24:07 +00:00
Gerson Fernando Budke 000257dad0 mgmt: updatehub: Move updatehub.h to header directory
This moves updatehub.h file from subsys to public header include
folder.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2023-01-23 10:24:07 +00:00
Gerson Fernando Budke 22e0a1faa6 mgmt: updatehub: Preparation to move public api
This prepares updatehub.h file to be moved to the public header
directory.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2023-01-23 10:24:07 +00:00
Nickolas Lapp be2906a64c NRF_QSPI_NOR: Exit DPD mode regardless of CONFIG_PM_DEVICE.
A call to exit_dpd mode for the nrf QSPI nor flash should always be
made, even if the currently executing image is compiled with
CONFIG_PM_DEVICE=n, because a previously executing image could have set
the device into DPD mode, and a call to exit_dpd is required for proper
functionality. Call `exit_dpd` regardless of the setting of
CONFIG_PM_DEVICE during QSPI nor initialization.

Signed-off-by: Nickolas Lapp <nickolaslapp@gmail.com>
2023-01-23 10:10:49 +00:00
Robert Lubos c6c2098255 net: iface: Add NULL pointer check in net_if_ipv6_set_reachable_time
In case the IPv6 context pointer was not set on an interface (for
instance due to IPv6 context shortage), processing the RA message could
lead to a crash (i. e. NULL pointer dereference). Protect against this
by adding NULL pointer check, similarly to other functions in this area.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-01-23 10:09:51 +00:00
Daniel Leung db495a5ebe xtensa: stop execution under simulator for double exception
If running under Xtensa simulator, it is good to tell simulator
to stop execution once we reach double exception, as the current
double exception handler is simply an endless loop. If we turn
on tracing in the simulator, the output file would contain
an infinite iteration of this endless loop, and the simulator
needs to be stopped manually before the file size goes out of
control. So we need to tell the simulator to stop once
we reach this point instead of doing an endless loop.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-01-23 10:09:18 +00:00
Ajay Parida ba39235275 net: wifi_mgmt: Add support for power save timeout configuration
Add support for configuring power save timeout in Wi-Fi chipsets.
Changes to configure power save inactivity timer.

Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
2023-01-23 10:08:01 +00:00
Dominik Ermel f05e8e8f27 tests: drivers: flash: Fix filter using non-existent partition
Filtering used image_1_nonsecure as DTS node label, while correct
one is slot1_ns_partition.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-01-23 10:06:50 +00:00
Mahesh Mahadevan ae97eae8c2 pm: Error with handling z_cpus_active count
z_cpus_active count becomes incorrect when the state is
PM_STATE_RUNTIME_IDLE and CONFIG_PM_DEVICE is enabled.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-23 10:06:17 +00:00
Martin Jäger 5dd50f9232 samples: subsys: lorawan: class_a: add clock sync option
Add an option to build the sample with application-layer clock sync
service running in the background.

This will also add a build-check for the clock sync service in CI.

Signed-off-by: Martin Jäger <martin@libre.solar>
2023-01-23 10:05:49 +00:00