Commit graph

15409 commits

Author SHA1 Message Date
Erwan Gouriou
5202d40520 include/drivers/clock_control: stm32: Missing PLL macro on some compats
STM32_PLL_ENABLED symbol is missing on F0/F1 and L0/L1 compatibles.
Fix that.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
83eb9c462b include/drivers/clock_control: stm32: Some HSE clocks are pure fixed-clocks
On STM32WB HSE clock is defined with "fixed-clock" compatible.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
f6db7afb60 drivers/clock_control: stm32 common: Use DT macros for bus prescalers
Simplify and clean up driver code using STM32 clocks DT based macros.

Added STM32_FLASH_PRESCALER macro for this purpose.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
30f0af97f8 drivers/clock_control: stm32 common: Factorize flash latency setting
Make use of LL_SetFlashLatency in all cases to update flash latency.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
0c60fcd40d drivers/clock_control: stm32u5: Use new clock bindings
This change updates stm32u5 driver to make use of new clock bindings.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
3f223496fa include/dt-bindings/clock: Add stm32u5 clock bindings
Introduce a new scheme to define clock bingings on u5.
In a next steps, this new scheme will allow to provide u5 specific
alternate and complementary device clocks.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
3069130245 include/drivers: stm32_clock_control: Avoid non defined PLL outputs
On some series (H7, U5), it is possible define clock configuration
with disabled PLL outputs.
In that case, it is legit that matching pll property is not available.
Define corresponding STM32_PLLX_Y_DIVISOR macros using DT_PROP_OR
to avoid build issues in case prop is not available.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
61a9016f88 drivers/clock_control: stm32h7: Change clock bus bindings values
Set bus binding values using registers offset values.
As a consequence update driver to take this into account
in clock_on and clock_off functions.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
2e4c02e722 dts/arm: stm32h7: Introduce a stm32h7 specific clock binding
This new binding allows to work on providing stm32h7 specific
alternate and complementary device clocks.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Carlo Caione
1dcea253d2 shared_multi_heap: Rework framework
Entirely rework the shared_multi_heap framework. Refer to the
documentation for more information.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-04-21 13:15:26 +02:00
Jordan Yates
d8f186aa4a arch: common: semihost: add semihosting operations
Add an API that utilizes the ARM semihosting mechanism to interact with
the host system when a device is being emulated or run under a debugger.

RISCV is implemented in terms of the ARM implementation, and therefore
the ARM definitions cross enough architectures to be defined 'common'.

Functionality is exposed as a separate API instead of syscall
implementations (`_lseek`, `_open`, etc) due to various quirks with
the ARM mechanisms that means function arguments are not standard.

For more information see:
https://developer.arm.com/documentation/dui0471/m/what-is-semihosting-

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>

impl
2022-04-21 13:04:52 +02:00
Peter Mitsis
a30cf39975 kernel: update k_thread_state_str() API
When threads are in more than one state at a time, k_thread_state_str()
returns a string that lists each of its states delimited by a '+'.
This in turn necessitates a change to the API that includes both a
pointer to the buffer to use for the string and the size of the buffer.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2022-04-20 20:20:13 -04:00
Yuval Peress
72f81021b2 include: move include files to correct location
Files should not be in the root include/ directory but instead under
the zephyr/ prefix path.

Issue #41543

Signed-off-by: Yuval Peress <peress@google.com>
2022-04-20 15:27:09 -04:00
Maxim Kolchurin
329cff8ab4 stm32: dt-bindings: fix AFIO_MAPR SPI3_REMAP0/1 bit pos
set SPI3_REMAP0/1 bit of AFIO_MAPR register to right position

Signed-off-by: Maxim Kolchurin <maxim.kolchurin@gmail.com>
2022-04-20 09:04:31 -05:00
Pete Dietl
a12aca2483 drivers: uart: Fix unused parameter warnings when compiling with -Wextra
Since the UART header file is included directly by application code,
an application developer including this file and only applying
-Wextra to the application source files will see many warnings.

Signed-off-by: Pete Dietl <petedietl@gmail.com>
2022-04-20 09:01:43 -05:00
Asbjørn Sæbø
b0d5db147b Bluetooth: Audio: Media control - pass structs by reference
Changes the media_proxy API to pass structs by reference instead of by
value.

Also pass structs by reference in internal functions in media player
and in media controller test.

Add pointer checks to the public API implementation where
user/application code provides structs by reference.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2022-04-20 15:51:01 +02:00
Asbjørn Sæbø
fa5b8a1e38 Bluetooth: Audio: MCC - pass structs by reference
Changes the media control client API to pass structs by reference
instead of by value.

Also change internals of test to pass struct by reference.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2022-04-20 15:51:01 +02:00
Jordan Yates
855f4b9c96 Bluetooth: hci: correct ext adv cmd definition
Update the definition of the set extended advertising data command to be
a variable array instead of hardcoded to the maximum length. This
conforms to the definition from the Bluetooth specification and allows
the corresponding code to be slightly cleaner.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-04-20 15:49:54 +02:00
Glauber Maroto Ferreira
2d05d945b6 esp32c3: dts: add pinctrl node and bindings
to support implementation and peripheral usage of the pinctrl
driver API.

Removes deprecated "use-iomux" property from the SPI node.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
dbd747b7f0 dts: xtensa: esp32s2: add pinctrl node and bindings
to support implementation and peripheral usage of the pinctrl
driver API.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
70d4a6c25e dts: esp32: add pinctrl bindings and definitions
to support implementation and peripheral usage of the pinctrl
driver API.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
135f4f772a drivers: pinctrl: esp32: initial support
add initial pinctrl driver support for ESP32.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Robert Lubos
e2fe8e7307 net: socket: Add option to create native TLS sock with offloaded TCP
In some cases (for examples when offloaded socket implementation does
not implement TLS functionality) it could be desired to create a native
TLS socket with an underlying offloaded socket.

This cannot be achieved with SO_BINDTODEVICE option only, as TLS socket
type is not really associated with a particular interface - it either
has to be offloaded, or a fully native socket is created (native TLS on
a native interface).

In order to address the problem, introduce TLS_NATIVE socket option.
This option instructs the socket dispatcher layer to create a native TLS
socket. As with the socket dispatcher the underlying socket
implementation is not decided during TLS socket creation, therefore it's
possible to use SO_BINDTODEVICE to choose either native or offloaded
interface for the underlying socket.

Additionally remove NET_SOCKETS_OFFLOAD_TLS Kconfig option, as it's no
longer needed with an runtime option to select whether to offload TLS or
not.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-04-20 11:27:05 +02:00
Robert Lubos
7946988b16 net: sockets: Add separate macro for registering offloaded sockets
Add a separate macro for registering offloaded sockets implementation,
along with information in the structure whether the implementation is
offloaded or not. This allows to differentiate between native and
offloaded socket implementations, which is critical for binding socket
API with an interface.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-04-20 11:27:05 +02:00
Robert Lubos
fa8ba73833 net: if: Connect interface with offloaded socket implementation
Instead of keeping a boolean informing whether a network interface is
offloaded at socket layer or not, keep a pointer to a function which
allows to create an offloaded socket. Native interfaces keep this as
NULL, while for offloaded interfaces it allows to connect an offloaded
socket implementation with an interface.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-04-20 11:27:05 +02:00
Anas Nashif
c9d0248867 kernel: introduce convinience apu to pin thread to a cpu
Add an API that clears cpu mask from a thread and sets it to a specific
CPU.

This is the equivelent of:

        k_thread_cpu_mask_clear(&thread);
	k_thread_cpu_mask_enable(&thread, cpu_idx);

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-04-19 13:05:09 -04:00
Georgij Cernysiov
951654cf18 include: dt-bindings: timer: stm32: move to correct dir
Moves dt-bindings constants file to correct location.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-04-19 11:49:42 +02:00
Georgij Cernysiov
7ce7f75ae9 include: dt-bindings: add stm32 fmc nor psram defines
Add defines to configure STM32
FMC NOR/PSRAM controller.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-04-19 11:47:06 +02:00
Flavio Ceolin
370ce60152 linker: Re-use device handle logic
Add a new file with the device handles logic that is included in both
ram and ROM

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-04-18 17:25:01 -07:00
Flavio Ceolin
acca447948 pm: device: Use pm flags to mark a power domain
Add a new flag that is used to tell whether or not a device is a power
domain. In order to a device be identified as a power domain the node
has to be compatible with "power-domain".

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-04-18 17:25:01 -07:00
Flavio Ceolin
605d785428 pm: Add an underline in device pm slot
Add an underline character before "slot" to make the sufix easier to
read.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-04-18 17:25:01 -07:00
Flavio Ceolin
0b13b44a66 pm: device: Dynamically add a device to a power domain
Add API to add devices to a power domain in runtime. The number of
devices that can be added is defined in build time.

The script gen_handles.py will check the number defined in
`CONFIG_PM_DEVICE_POWER_DOMAIN_DYNAMIC` to resize the handles vector,
adding empty slots in the supported sector to be used later.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-04-18 17:25:01 -07:00
Henrik Brix Andersen
d5f3f20edb drivers: can: allow calling can_set_bitrate() from userspace
Add syscall to allow calling can_set_bitrate() from userspace.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-18 17:23:28 -07:00
Vaishnav Achath
e2ed8cf130 drivers: pinctrl: add CC13XX/CC26XX pinctrl driver
Add pinctrl driver for CC13XX/CC26XX family of SoCs
to facilitate transition from pinmux to pinctrl.

`IOCPortConfigureSet()` from TI hal driverlib used to
implement the generic pinctrl driver.

Signed-off-by: Vaishnav Achath <vaishnav@beagleboard.org>
2022-04-18 18:19:46 -04:00
Yuval Peress
8da60c3c7e cpp: Update structs to be compatible with C++
Both the `_cpu_arch` and `k_thread_runtime_stats` structs can have a
size of 0 in C, but will fail when building with C++. Add an extra
byte in those cases.

Signed-off-by: Yuval Peress <peress@google.com>
2022-04-18 13:21:52 -05:00
Anas Nashif
8d7a4f79fb kernel: fix cpu_mask api documentation
wrong kconfig is being used in the note, DEADLINE is not related to cpu
mask APIs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-04-15 16:14:14 -07:00
Georgij Cernysiov
fcab131279 include: dt-bindings: timer: add stm32 timer constants
Adds timer countermode constants.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-04-15 11:59:16 -07:00
Piotr Pryga
4a18d615a4 slist: Fix sys_slist_append_list with head and tail NULL break a list
If the sys_slist_t instance is not empty, its head and tail points to
some sys_snode_t instances. If sys_slist_append_list is executed with
tail being NULL the list object is corrupted. Tail of the sys_slist_t
instance is set to NULL. If one executes sys_slist_append on that node,
then nodes pointed by head are lost.

The commit fixes the issue and adds unit tests to verify correct
behavior.

Added change verifies if head and tail of appended list are not NULL.
In other case the list object is invalid and should not be appended
to a valid list instance.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-04-15 11:50:29 -07:00
Mariusz Skamra
4ac9eba3d5 Bluetooth: has: Add initial support for presets
This adds initial support for presets that includes API functions
to register/unregister presets and Read Preset Request control point
handler.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-04-15 10:32:54 -07:00
Pete Dietl
41e30f0234 drivers: i2c: Fix unused parameter warnings when compiling with -Wextra
Since the i2c header file is included directly by application code,
an application developer including this file and only applying
-Wextra to the application source files will see this warning.

Signed-off-by: Pete Dietl <petedietl@gmail.com>
2022-04-14 14:49:48 -05:00
Jaska Uimonen
783a96a71b drivers: add new audio dai driver interface
The DAI (digital audio interface) API is a high level audio driver
abstraction. It provides support for the standard I2S (SSP), DMIC, HDA
and SDW backends. The API has a config function with bespoke data
argument for device/vendor specific config. There are also optional
timestamping functions to get device specific audio clock time.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-04-14 11:42:08 -04:00
Krzysztof Chruscinski
8b0d429bfd logging: Add timestamp getter function part of internal API
Expose timestamp getter so it can be used, e.g. in the frontend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-04-13 13:45:36 -07:00
Krzysztof Chruscinski
24372f4e84 logging: Fix control macros for FRONTEND_ONLY case
When only frontend is used, core initialization and panic notification
should still be called. Before that change macros for that were empty
when CONFIG_LOG_FRONTEND_ONLY=y.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-04-13 13:45:36 -07:00
Nicolas Pitre
4f1988fbfd riscv: small arch_irq_* cleanup and optimization
- Allow immediate argument with the csrrc instruction
- Replace csrrs with csrs and avoid a needless register allocation
- Mask the MSTATUS_IEN only at the consumer
- Remove unappropriate comment

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2022-04-13 13:28:51 -07:00
Henrik Brix Andersen
fba27b4bde drivers: can: change sample point for can_set_bitrate() at high bitrates
CAN in Automation (CiA) 301 v4.2.0 recommends a sample point location of
87.5% percent for all bitrates. However, some CAN controllers have
difficulties meeting this for higher bitrates.

Change can_set_bitrate() to use a sample point of 75.0% for bitrates
over 800 kbit/s, 80.0% for bitrates over 500 kbit/s, and 87.5% for all
other bitrates. This is in line with the sample point locations used by
the Linux kernel.

Regard a sample point error of more than +/- 5.0% as an error in setting
the bitrate. Previously, any sample rate error was accepted without
providing any feedback to the caller. This is in line with the CAN
sample point calculation criteria used by the Linux kernel.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-13 13:28:06 -07:00
Damian Krolik
5f5410a0cc sys: heap: support maximum allocated bytes statistic
Besides the current allocated/free bytes, keep track of
the maximum allocated bytes to help determine the heap
size requirements. Also, provide a function to reset
the statistic.

Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
2022-04-13 13:27:28 -07:00
Daniel Leung
3539db43ef lib: os: cbprintf: use TOOLCHAIN_HAS_C_GENERIC macro instead
Since toolchain.h supplies the macro TOOLCHAIN_HAS_C_GENERIC to
indicate if the compiler supports C Generic, there is no need to
do the long chain of macro arithmetic in cbprintf header file.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-04-13 08:29:23 -05:00
Christopher Friedt
7c583bbf8f lib: posix: support for pthread_attr_setstacksize
Support pthread_attr_setstacksize(3).

See https://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_attr_getstacksize.html

Fixes #44722

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2022-04-12 22:02:04 +09:00
Szymon Czapracki
af2e781f5a Bluetooth: Immediate Alert Service
This commits adds IAS for zephyr bluetooth.

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
2022-04-12 09:59:34 +02:00
Veijo Pesonen
d1751cafd3 net: lwm2m: adds LwM2M specific shell command
First available subcommand is for doing a send operation. Send operation
is supported by the LwM2M version 1.1.

Signed-off-by: Veijo Pesonen <veijo.pesonen@nordicsemi.no>
2022-04-12 09:57:20 +02:00