Commit Graph

9479 Commits

Author SHA1 Message Date
Abe Levkoy
eba8d6d18f emul.h: Fix includes
Include devicetree.h, whose contents are already used in this file. Sort
included headers.

Signed-off-by: Abe Levkoy <alevkoy@google.com>
2022-08-17 15:47:52 +00:00
Daniel Leung
7dc20978e3 lib: os: cbprintf: fix typo exteral -> external
The cbprintf formatter cbvprintf_exteral_formatter_func has a typo
in it with a missing 'n'. So add it.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-08-17 08:08:46 +00:00
Tim Cooijmans
4c285fc53c drivers: lora: Add support for setting sync-word and iq-inverted
Add support for setting sync-word and iq-inverted in lora_modem_config. By
being able to set the sync-word it's possible to send "raw" public-network
packets using lora_send and using iq-inverted both uplink and downlink
messages can be sent.

Signed-off-by: Tim Cooijmans <timcooijmans@gmail.com>
2022-08-16 18:06:18 +02:00
Tim Cooijmans
b85fdf57a4 drivers: lora: Add documentation for the lora_modem_config struct.
Adds documentation for the fields in lora_modem_config.

Signed-off-by: Tim Cooijmans <timcooijmans@gmail.com>
2022-08-16 18:06:18 +02:00
Mariusz Skamra
cc86b9213c Bluetooth: conn: Extend bt_conn_info with security information
This extends the bt_conn_info with security information. This is needed
by LE Audio profiles to check if security requirements are met.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-08-16 12:19:43 +02:00
Mariusz Skamra
391a26138a Bluetooth: conn: Move bt_security_t definition
This moves bt_security_t definition to be used later in bt_conn_info.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-08-16 12:19:43 +02:00
Mariusz Skamra
cc37266742 Bluetooth: conn: Add const modifier to conn
The bt_conn_get_security and bt_conn_enc_key_size do not
modify the conn thus the parameter can be guarded with const modifier.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-08-16 12:19:43 +02:00
Evgeniy Paltsev
961df14f39 ARC: Check that ISR and exception stacks are proper aligned
CONFIG_ISR_STACK_SIZE and CONFIG_ARC_EXCEPTION_STACK_SIZE are
used in arc asembler code without C wrapper on them with following
manner:

---------------------------->8----------------------------
/#define INIT_STACK z_interrupt_stacks
/#define INIT_STACK_SIZE CONFIG_ISR_STACK_SIZE

	mov_s sp, INIT_STACK
	add sp, sp, INIT_STACK_SIZE
---------------------------->8----------------------------

In result we can get stack unaligned if we have
CONFIG_ISR_STACK_SIZE or CONFIG_ARC_EXCEPTION_STACK_SIZE
values unaligned. There is no point to have unaligned stack
size - so let's check against such configurations in
compile time.

Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2022-08-16 08:25:51 +00:00
Wolfgang Puffitsch
eb684905ea device.h: Do not generate "okay" devicetree nodes if DT is unsupported
The macro DT_FOREACH_STATUS_OKAY_NODE is only available if devicetree
is supported. Using it for platforms that do not support devicetree
causes compilation errors.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2022-08-15 11:10:51 -07:00
Christoph A Schnetzler
6fc4bb9486 kernel: Prevent Wundef
prevent `Wundef` warnings from occurring due to
missing CONFIG_ symbols and __cplusplus.

Signed-off-by: Christoph A Schnetzler <Christoph.Schnetzler@husqvarnagroup.com>
2022-08-15 14:36:47 +02:00
Anas Nashif
f991fe0197 xcc: do not call ASSERT in CODE_UNREACHABLE
230ddd9a7f added unreachable path hint for assertion failure. Xcc does
not support __builtin_unreachable and this was defined as a call to
ASSERT, which generated some recursion.

Replace the definition with __builtin_trap() to work around this issue.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-08-12 14:40:26 -04:00
Henrik Brix Andersen
c11326300f drivers: can: remove option for configuring CAN-FD max DLC
Remove the Kconfig option for configuring the maximum value of the CAN-FD
Data Length Code in order to ensure standard compliance.

Allowing users to configure the max DLC allows the user to save a number of
bytes per CAN frame in RAM, but it also renders the Zephyr CAN-FD
implementation non-compliant with the CAN-FD standard.

There are no guarantees that a Zephyr CAN-FD node will not receive a CAN
frame with a DLC higher than the Kconfig limit, which opens up for all
sorts of bugs when trying to handle received CAN-FD frames.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-12 14:15:10 +01:00
Gerard Marull-Paretas
be21b45522 drivers: spi: fix sample syntax
Upcoming versions of breathe highlight code embedded in Doxygen blocks.
In this case, the Devicetree fragment contained invalid syntax leading
to Sphinx warnings.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-12 11:04:26 +02:00
Fabio Baltieri
87e148e0aa Restore "device.h: rework the device_extern.h mechanism"
This reverts commit 5b2ba9aaeb, restoring
commit 0224f2c508.

Restore the original change now that the underlying issue has been fixed
in 6cfb18686e.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-12 07:45:01 +01:00
Fabio Baltieri
5b2ba9aaeb Revert "device.h: rework the device_extern.h mechanism"
This reverts commit 0224f2c508.

Seems to be breaking CI for few qemu platforms.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-11 17:21:46 -05:00
Tom Burdick
a45ece6984 i2c: Adds i2c_transfer_async API for I2C
i2c_transfer_async is the asynchronous version of i2c_transfer where
the completion of the transfer is notified to the caller using a callback.

This can be used in conjuction with the common callbacks and datatypes
in async.h for directly doing an async transfer with an IPC object
to notify a thread.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-08-11 14:12:13 -04:00
Gerard Marull-Paretas
d322adc66f devicetree: s/devicetree_unfixed/devicetree_generated
Because the fixup files do not exist anymore, stop using "unfixed"
naming in favor of "generated".

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-11 12:17:02 +02:00
Gerard Marull-Paretas
b2520b09a7 devicetree: drop support for dts_fixup.h files
Devicetree fixup files existed previous to the current stable Devicetree
API. While they served their purpose, they are no longer necessary nor
used in-tree. This patch drops support for this legacy feature.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-11 12:17:02 +02:00
Anas Nashif
b1074152b0 intel_adsp: move z_soc_irq_* declarations
Move prototype declaration to include/zephyr/arch/xtensa/irq.h.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-08-10 14:30:45 -04:00
Krishna T
dace99ebdd wifi_mgmt: Add support for frequency bands
Channels are not unique across bands, they need to be interpreted along
with frequency band. Add a separate band parameter that supports 2.4, 5
and 6 GHz bands.

Also, 6GHz has maximum channel of 233 (as of now), so, change the
maximum channel to that, this is a global maximum, per-band channel
validation is left to the offload driver as that depends on regulatory
rules (not a simple maximum check).

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2022-08-10 16:05:09 +02:00
Krishna T
0fb3f35e49 wifi_mgmt: Add support for MFP
MFP (Management frame protection) a.k.a PMF (protected management
frames) is now a mandatory feature for certification esp. for WPA3.

Support is added for both scan and connect similar to security type.

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2022-08-10 16:05:09 +02:00
Krishna T
dd7cc72e99 wifi_mgmt: Add WPA3-SAE support
SAE password is similar to WPA2 password but without any length
restrictions, so, add a separate optional field, if this is not given we
can fallback to WPA2 password (psk).

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2022-08-10 16:05:09 +02:00
Krishna T
1d932fded6 wifi_mgmt: Add PSK with SHA256 support
This is a variant of standard PSK which uses KDF instead of PRF for
key generation, see section Table 9-151 in [1].

[1] - https://standards.ieee.org/ieee/802.11/7028/

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2022-08-10 16:05:09 +02:00
Stephanos Ioannidis
230ddd9a7f lib: os: assert: Add unreachable path hint for assertion failure
This commit adds the `CODE_UNREACHABLE` hint at the end of the
assertion failure branch so that the compiler takes note of the assert
function not returning when an assertion fails.

This prevents the compiler from generating misguided warnings assuming
the asserted execution paths.

It also introduces the `ASSERT_TEST` Kconfig symbol, which indicates
that the "assert test mode" is enabled. This symbol may be selected by
the tests that require the assert post action function to return
without aborting so that the test can proceed.

Note that the `CODE_UNREACHABLE` hint is specified only when the assert
test mode is disabled in order to prevent the tests from crashing when
the assert post action function returns.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-08-10 14:32:36 +02:00
Marek Pieta
d5a453efaf bluetooth: smp: Add authentication callbacks per connection
Change introduces authentication callbacks used only for specified
BLE connection. The feature can be used by devices that require
reporting specific bonding capabilities only when pairing using
vendor-specific procedures.

If per-connection authentication callbacks are defined for given
connection, they are used instead of global authentication
callbacks. SMP latches authentication callbacks during the first
access to prevent updating the callbacks while pairing.

Fixes: #38336

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2022-08-10 12:49:30 +02:00
Yuval Peress
84dfb8edf8 ztest: allow asserts anywhere
Updates the ztest_test_fail() function to allow failures in setup.
When executed, a failed assert will fail every test in the suite owning
the setup function. This was verified by adding a suite which asserts
in the setup function and has a test that should pass. During
exeuction, ztest marks the test as failing.

In order to verify exection I also added 2 new APIs:
- ZTEST_EXPECT_FAIL(suite_name, test_name)
- ZTEST_EXPECT_SKIP(suite_name, test_name)

Signed-off-by: Yuval Peress <peress@google.com>
2022-08-09 13:30:15 -04:00
Henrik Brix Andersen
a0b0f053e3 drivers: clock_control: avoid calling device_is_ready() in API calls
Change the clock control driver API to not call device_is_ready() in every
API call. It is up to the caller to ensure that the clock control device is
ready before calling a clock control API function.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
aa856bb00d drivers: clock control: clarify possible return values
Document the possible return values from clock_control_get_rate().

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-08-09 17:13:40 +02:00
Gerard Marull-Paretas
a7c3e7e84a doxygen: remove redundant usages of def
The def command Indicates that a comment block contains documentation
for a #define macro. This is useful if the comment block documents a
macro not adjacent to it, e.g.

```c
/**
 * @def MAX(x,y)
 * @brief Computes the maximum of @a x and @a y.
 */
 #ifdef XXX
 #define MAX(x,y) ...
 #endif
```

However, it is not necessary if the comment is adjacent to the
definition, e.g.

```c
/**
 * @brief Computes the maximum of @a x and @a y.
 */
 #define MAX(x,y) ...
```

This patch removes all unnecessary def entries in-tree.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-09 12:29:28 +02:00
Erwan Gouriou
7911fc3c35 include: dt-bindings: stm32 clocks: Use "domain" wording when possible
Update stm32 clocks include files to use "domain" when possible.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-08 14:17:07 +02:00
Erwan Gouriou
1ef9e9eb9b include: drivers: stm32 clock_control: Replace OPT by DOMAIN
In the continuation of the previous commit, replace _OPT_ by _DOMAIN_
in macros relating to this feature.
hen, adapt drivers and tests to this new wording.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-08 14:17:07 +02:00
Krishna T
b754e63d1b net: ethernet: Add EAPoL ether type support
Wi-Fi protocol uses EAPoL ether type frames for authentication, so, add
support for that ether type so that they are not dropped.

Though we have NET_ETHERNET_FORWARD_UNRECOGNISED_ETHERTYPE to allow
unknown frames to be passed up the stack, but this might cause
performance penalty.

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2022-08-08 14:03:54 +02:00
Martí Bolívar
0224f2c508 device.h: rework the device_extern.h mechanism
Now that we can iterate over all the status "okay" devicetree nodes
directly using <zephyr/devicetree.h>, use that along with a new helper
macro to pre-declare all possible struct devices.

Unlike the previous implementation, which declared devices even for
disabled nodes, we restrict the new mechanism to only declaring
devices for status "okay" nodes. This keeps drivers honest by not
pre-declaring devices for disabled nodes, which should not be
allocated in the first place.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-08-08 10:44:41 +02:00
Martí Bolívar
2520747f6b devicetree.h: DT_FOREACH_NODE, DT_FOREACH_STATUS_OKAY_NODE
Add two new utility macros for iterating over the entire tree, along
with tests.

I have a use case for DT_FOREACH_STATUS_OKAY_NODE() right now, but I
think it makes sense to define both of them right away for
completeness.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-08-08 10:44:41 +02:00
Martí Bolívar
b23e1727b6 device.h: add missing include
This header makes extensive use of devicetree macros, but it does not
include zephyr/devicetree.h. Fix it.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-08-08 10:44:41 +02:00
Nazar Palamar
5897de1e53 include/net: add the alignment for data in NET_BUF_POOL_FIXED_DEFINE
NET_BUF_POOL_FIXED_DEFINE locates net_buf_data in __noinit section,
it does not guarantees that data buffer will aligned.

There is wifi driver which required network buffers to be aligned.

Changes:
line below (from NET_BUF_POOL_FIXED_DEFINE macro):
 static uint8_t __noinit net_buf_data_##_name[_count][_data_size];
is updated to:
 static uint8_t __noinit net_buf_data_##_name[_count][_data_size]
 __net_buf_align;

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2022-08-08 06:58:51 +01:00
Andreas Chmielewski
74a56b05a9 net: lwm2m: separate closing context from closing socket
Separate closing lwm2m context from closing socket. This patch is required
for the rd client to take more control over lwm2m context and the socket.
The goal is to close the socket and to keep the lwm2m context if this is
needed.

Signed-off-by: Andreas Chmielewski <andreas.chmielewski@grandcentrix.net>
2022-08-08 06:55:49 +01:00
Andriy Gelman
af6179d567 drivers: gpio: Add xmc4xxx drivers
Adds gpio drivers for xmc4xxx SoCs.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-08-05 13:00:21 +02:00
Aurelien Jarno
c24acd0c26 drivers: adc: fix ADC_DT_SPEC* helpers for channels >= 10
Use the just introduced IS_EQ() to get the channel child node matching the
input.

Fixes #47119

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-08-04 17:35:39 +01:00
Aurelien Jarno
d98a75a4cb sys: util: export Z_IS_EQ macro as IS_EQ
And also add the corresponding documentation.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-08-04 17:35:39 +01:00
Kumar Gala
9341b98821 sys: util: add a Z_IS_EQ macro to compare integers
This macro compares two integers from 0 to 255 at compile time, using
the preprocessor.

Signed-off-by: Kumar Gala <galak@kernel.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-08-04 17:35:39 +01:00
Florian Grandel
6b09d0e791 net: l2: ieee802154: apply clang format
This change makes the files which are part of this changeset comply to
the project's coding style rules as defined in .clang-format.

This required addition of some forward declarations and additional
dependencies into header files as some of them depended on the order of
header inclusion which was changed due to alphabetical ordering of
includes.

Background: .clang-format states "SortIncludes:true" which will force
re-ording of include-statements which in turn might break the build if
header file inclusion is not order-independent.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-08-04 13:44:06 +02:00
Juha Heiskanen
ed5f3cdf06 net: lwm2m: LwM2M Pause and resume support
New API for suspend and resume LwM2M engine.
New event LWM2M_RD_CLIENT_EVENT_ENGINE_SUSPENDED for indicate
application that engine is suspended.

Simplify stack suspend and resume state same time for queue mode.

New CONFIG_LWM2M_RD_CLIENT_SUSPEND_SOCKET_AT_IDLE for enable skip socket
close at RX_OFF_IDDLE state that socket is only suspended and close is
called only when connection is resumed.

Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
2022-08-04 13:42:55 +02:00
Gerard Marull-Paretas
a650c6c554 pm: policy: allow multiple subscribers to latency changes
Current API allowed to get notified when the maximum system latency
changes, however, a single callback was allowed. The design was intended
for SoC specific actions when latency changes. However, in some cases
drivers may also want to know the current maximum latency to perform
local actions if other parts of the system modify it.

This patch updates the API with a pair of subscribe/unsubscribe calls to
achieve such goal. Tests have been updated to show how the API can be
used.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-03 11:19:17 +02:00
Fabio Baltieri
24d09d363c include: fix the remaining legacy #include paths
Add the "zephyr/" prefix to various #include statements that are
preventing the CI form running with LEGACY_INCLUDE_PATH=n.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-02 16:41:41 +01:00
Andrzej Puzdrowski
ccf8c547d0 settings: API for get storage instance used
Added API function +int settings_storage_get(void **storage)
which allows to get storage instance used by the
settings backed to store its records.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-08-02 15:15:10 +02:00
Piotr Pryga
c6e9b3c235 Bluetooth: hci: Extend VS fatal error for hard hault and assert
Extend current implementation of vendor-specific HCI events related
with Zephyr Fatal Error. The extended event is able to carry Zephyr
system wide fatal error as well as Controller related assertion.
That gives a possibility to use the event by bt_ctlr_assert_handle
or k_sys_fatal_error_handler to send information about unrecoverable
failures over HCI interface.

There are added two types of errors to Zephyr Fatal Error event:
- system fault error like e.g. Hard Fault. This one caries reason of
  a fault and a stack frame in the data field. The stack frame is
  defined for Corte-M SoCs only.
- Controller assert. The data field caries file name and line of code
  where an assert happened.

Except that the extended event can be used by Host, it can serve as a
debug mean to conformance testing of the Controller.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-08-02 13:53:32 +02:00
Gerard Marull-Paretas
6de9fcf315 soc: riscv: gd32vf103: use nuclei,systimer compatible
After some analysis I found out that there's no machine timer provided
by the "riscv" vendor. There are some specs for the mtime/mtimecmp
registers (this is why we can have a single driver), but the actual
register layout or implementations differ amongst vendors. GD32 uses the
Nuclei implementation, named "system timer" in their documentation. This
patch aligns with vendor specs.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-02 09:12:31 +02:00
Michal Narajowski
fab8e29ee2 Bluetooth: Mesh: Add model publish support to Health Client
Mesh Profile Specification errata 11310
Section 4.4.4.1
"This model shall support model publication, as defined in Section
4.2.2 of the Mesh Profile specification and model subscription,
as defined in section 4.2.3 of the Mesh Profile specification."

Signed-off-by: Michal Narajowski <michal.narajowski@codecoup.pl>
2022-08-01 18:04:42 +01:00
Nikolai Kondrashov
26eb116835 Bluetooth: GATT: Spell out BT_ATT_ERR_*
Spell out BT_ATT_ERR_* instead of using less specific "ATT error code".

Co-authored-by: Emil Gydesen <Thalley@users.noreply.github.com>
Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
2022-08-01 18:04:02 +01:00