Commit graph

15409 commits

Author SHA1 Message Date
Krzysztof Chruscinski
336c1ad7d2 drivers: tiemr: nrf_rtc_timer: Add test function for shifting time
RTC is 24 bit width and k_timer is 64 bit. It is hard to test corner
cases but RTC hardware feature can help here. There is a task which
moves counter to 0xfffff0 which is close to overflow. However, there
is an internal driver state that also needs to be aligned to shift
the time properly. Adding optional function which triggers overflow
and updates internal state. This can be used for testing corner cases.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-11-17 11:24:23 +01:00
Flavio Ceolin
e3aac24821 xtensa: linker: Use zephyr's convention for rodata
Zephyr maps start/end of rodata section with variables
using __rodata_region namespace. The exception was Xtensa.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-11-17 15:44:48 +09:00
Nikolay Agishev
6e215ce6af boards: nsim_hs: Add separate config for XIP memory organization
Add XIP support with MWDT toolchain. To have it proper tested
add separate nsim platforms for XIP (flash + sram) and
non-XIP (sram) memory organization in addition to existing
nsim_hs platfor with CCMs (ICCM + DCCM) memory organization.

This PR also enables MPU for all nsim hs3x based platforms
(like we previously enabled it for qemu_arc_hs) to have proper
memory regions permissions.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
2022-11-16 11:18:51 +01:00
Johan Hedberg
0eed096f99 pcie: Add support for centralized lookup of BDF values
The BDF values can differ on the same platform, based on e.g. BIOS
configuration, and in the case of qemu the command line parameters. It's
therefore more reliable to always look up the BDF value based on the
known Vendor and Device IDs.

This patch introduces such a framework, and allows the incremental
update of PCIe drivers to start taking advantage of it.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2022-11-16 11:18:43 +01:00
Emil Gydesen
ecb7591d6b Bluetooth: Audio: Rename BASS and BASS client
Rename BASS to BAP Scan Delegator and BASS Client
to BAP Broadcast Assistant. This is the first step towards
integrating the BASS with the rest of BAP.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-16 11:17:52 +01:00
Henrik Brix Andersen
1885bee7c3 drivers: eeprom: add fake EEPROM driver
Add a FFF-based fake EEPROM driver which can be used either as a stub or a
mock for testing.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-11-15 09:43:42 -06:00
Jamie McCrae
b7cc0cd056 mgmt: mcumgr: Fix smp_transport_clear_check_fn typo
Fixes a typo that should be smp_transport_query_valid_check_fn

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-11-15 16:00:42 +01:00
Henri Xavier
0f2d763099 pcie: Write MSI-X vectors using sys_write32
It was previously written as regular members of a struct, which
allows the C compiler to do things the way it wants. On ARM64, gcc
would typically write field by pairs (`STP`), which
would generate aborts.

By using `sys_write32`, we force it the right way.

Signed-off-by: Henri Xavier <datacomos@huawei.com>
2022-11-15 12:20:21 +00:00
Emil Gydesen
1d83e561e6 Bluetooth: Audio: Refactor use of cur_mcs_inst
Removes the global cur_mcs_inst and replace it
with lookup functionality.

This fixes an issue with bt_mcc_discover_mcs not being able
to be called more than once, as well
as streamline the implementation significantly.

This is also the first step towards not only supporting
multipe MCS instances for a single device, but also a
step towards handling multiple devices.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-15 12:18:50 +00:00
Ryan Erickson
e01f977da1 modem: hl7800: Fix +CCID response to handle EID
For SIM cards that support eSIM, the +CCID response
will contain the ICCID and the EID.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-11-15 12:17:20 +00:00
Dominik Ermel
220c08967c mgmt/mcumgr: Correct serial frame size
Zephyr has been using 128 byte frame size instead of 127.
This change only affects buffer size as Base64 encodig,
together with preamble and terminating new line character,
has been only able to use 127 bytes of frame anyway,

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-11-15 13:06:02 +01:00
Rodrigo Peixoto
b8ecbfaa57 zbus: Add message bus subsystem to Zephyr
Add zbus message bus as a Zephyr subsystem. No message bus
or communication abstraction other than the usual (message queues,
mailboxes, etc.) enabled developers to implement event-driven systems in
Zephyr quickly. Zbus would fill that gap by providing the community with
a lightweight and flexible message bus. The implementation tries to be
closest as possible to the existing ones. We use the claim/finish
approach, and the API for publishing and reading channels are similar
in message queues. Zbus is about channels, messages, and observers.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2022-11-14 17:25:29 -05:00
Chris Friedt
b0b4c9c3f1 posix: mutex: abstract pthread_mutex_t as uint32_t
Consistent with the change of `pthread_t` from
`struct posix_thread` to `uint32_t`, we can now also abstract
`pthread_mutex_t` as `uint32_t` and separate `struct posix_mutex`
as an implementation detail, hidden from POSIX API consumers.

This change deprecates `PTHREAD_MUTEX_DEFINE()` in favour of the
(standardized) `PTHREAD_MUTEX_INITIALIZER`.

This change introduces `CONFIG_MAX_PTHREAD_MUTEX_COUNT`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2022-11-15 05:56:31 +09:00
Gerard Marull-Paretas
f7cb0933fc drivers: regulator: s/uV/uv and s/uA/ua
Zephyr coding style uses all-lowercase.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-14 16:59:05 +01:00
Gerard Marull-Paretas
6d744d3dd2 drivers: regulator: use int32_t for voltages/currents
Right now we had a mix of int (signed) and uint32_t (fixed-width
unsigned integer). Use int32_t for all cases, both values may be either
positive/negative, and we have a defined range when using fixed-width
integers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-14 16:59:05 +01:00
Gerard Marull-Paretas
0a390b3ed6 drivers: regulator: improve Doxygen
The recently moved "consumer" API had multiple Doxygen issues. This
patch improves the Doxygen docs, e.g. use `@retval`, remove redundant
docs, improve parameter docs, etc.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-14 16:59:05 +01:00
Gerard Marull-Paretas
ec3c566f8c drivers: regulator: convert all API calls to use ops
The previous "consumer" API was designed without API ops, meaning only a
single implementation (singleton) was possible. This was inconsistent
with all other APIs, and, a problem in systems where more than a single
PMIC IC is present.

Note that all "consumer" ops are optional, so this won't break any
existing drivers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-14 16:59:05 +01:00
Gerard Marull-Paretas
74e40f88ae drivers: regulator: move consumer.h to regulator.h
In Zephyr all regulator APIs are consumer APIs. There's no point in
adding a separate header file. Our current implementation is also
inconsistent with Linux, where enable/disable are also part of the
consumer.h API.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-14 16:59:05 +01:00
Benjamin Lindqvist
85c6de4335 lorawan: enable run-time config of region/freq
This commit adds support for compiling in support for several different
regions/frequencies and dynamically choosing which to use in run-time.
This commit introduces no API breakages - if a prj.conf contains only a
single region Kconfig, the new function lorawan_set_region() does not
need to be called.

Signed-off-by: Benjamin Lindqvist <benjamin@eub.se>
2022-11-14 11:16:16 +00:00
Gerard Marull-Paretas
8d0eb6ce10 devicetree: remove deprecated DT_CHOSEN_*_LABEL macros
DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL and
DT_CHOSEN_ZEPHYR_ENTROPY_LABEL were deprecated a couple of releases ago,
so it is time to remove them. Note that the zephyr/devicetree/zephyr.h
is also removed, since both macros were its last content.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-11 11:00:26 +01:00
Gerard Marull-Paretas
f7d24f78a2 fs: nvs: remove deprecated nvs_init
nvs_init was changed in favor of nvs_mount a couple of releases ago. It
is now time to remove it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-11 11:00:26 +01:00
Gerard Marull-Paretas
8e04922f35 drivers: pwm: remove deprecated functions
Improved PWM API has shipped on the last 2 Zephyr releases (3.1, 3.2),
so it is time to remove deprecated functions.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-11 11:00:26 +01:00
Gerard Marull-Paretas
7dc047406c include: util_macro: remove deprecated UTIL_LISTIFY
Macro was deprecated 2 releases ago, it is now time to remove it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-11 11:00:26 +01:00
Gerard Marull-Paretas
b0dc5eee36 drivers: gpio: remove deprecated drive strength/voltage/debounce flags
Such generic flags were replaced for vendor-specific flags. Zephyr
releases 3.1 and 3.2 have shipped with the flags deprecated, it is now
time to remove them.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-11 11:00:26 +01:00
Gerard Marull-Paretas
b1552001bf drivers: gpio: npcx: fix usage of deprecated voltage macros
The NPCX driver did use deprecated voltage macros. Define vendor
specific flags instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-11 11:00:26 +01:00
Gerard Marull-Paretas
4f4ca3905d linker: devicetree_regions: add missing includes
The devicetree_regions.h did not include any header, however, it uses
multiple APIs: DT, utils and toolchain macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-11 11:00:26 +01:00
Gerard Marull-Paretas
8aa0baed3d pm: policy: add missing include
zephyr/pm/policy.h is using ARG_UNUSED without including
zephyr/toolchain.h.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-11 11:00:26 +01:00
Gerard Marull-Paretas
21c4bbe385 driver: watchdog: multiple doxygen improvements
- Fix incorrect struct fields documentation (`@param` can't be used)
- Removed redundant `@file` entry, public APIs may be split into
  multiple headers.
- Grouped and anchored options and flags, so they can be referenced.
- Guarded some internal fields with INTERNAL_HIDDEN.
- Exposed conditional struct fields, using __DOXYGEN__.
- Use `@see` in cases where used was instructed to look at other
  function calls.
- Added `errno` `@retval` to all functions. In case of external
  watchdogs, communication errors may be propagated.
- Other minor/typo fixes

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-10 22:41:43 -05:00
Daniel Leung
bbb2f8277a uart: ns16550: move command macro to public header
This moves the CMD_SET_DLF command macro to public header
so application can use it without weird include path to
include the "private" header file under drivers/serial.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-11-10 22:40:21 -05:00
Gerard Marull-Paretas
33e583b643 drivers: regulator: s/reg/dev
Use "dev" for device instance variable for consistency with other driver
classes.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-10 17:58:48 +01:00
Gerard Marull-Paretas
e68ba0fd5b drivers: regulator: fix includes
File was including zephyr/types.h and zephyr/drivers/gpio.h for nothing,
and missed zephyr/device.h

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-10 17:58:48 +01:00
Gerard Marull-Paretas
ee90deeafd drivers: regulator: improve Doxygen documentation
- Remove redundant `@file`
- Hide driver-specific code using `INTERNAL_HIDDEN`.
- Use standard `@funcprops`
- Use `@retval` for return codes, and clarify them as well. Added -errno
  case, since external regulators may propagate e.g. bus errors.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-10 17:58:48 +01:00
Jamie McCrae
c2b872b901 mgmt: mcumgr: os_mgmt: Switch to new event callback system
Switches to the new event callback system for the os_mgmt
functionality and removes the old code.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-11-10 12:34:39 +01:00
Jamie McCrae
986ea39512 mgmt: mcumgr: img_mgmt: Switch to new event callback system
Switches to the new event callback system for the img_mgmt
functionality and removes the old code.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-11-10 12:34:39 +01:00
Jamie McCrae
4e8fde15a3 mgmt: mcumgr: fs_mgmt: Switch to new event callback system
Switches to the new event callback system for the fs_mgmt
functionality and removes the old code.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-11-10 12:34:39 +01:00
Jamie McCrae
6f75c99b8b mgmt: mcumgr: Rework event callback system
Reworks the event callback system to use a linked list to allow for
chained handlers and support passing a status back to the handler to
indicate if the request should be rejected or allowed. This also
removes the old base callback functionality.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-11-10 12:34:39 +01:00
Guillaume Gautier
00504fd585 include: zephyr: dt-bindings: clock: Add RTC clk src defines for STM32
For all STM32 series, add some defines to select the RTC clock source.
This change is necessary to be able to select the RTC clock source in
dts instead of Kconfig

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-11-10 11:27:49 +00:00
Guillaume Gautier
a407c4e04e include: zephyr: drivers: clock_control: Add stm32 lse bypass
Add a define to get the value of the LSE bypass property from dts

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-11-10 11:27:49 +00:00
Jamie McCrae
2aca1242f7 mgmt: mcumgr: Fix Bluetooth transport issues
This fixes issues with the Bluetooth SMP transport whereby deadlocks
could arise from connection references being held in long-lasting
mcumgr command processing functions.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-11-10 11:08:52 +01:00
Emil Gydesen
79ca8f7f43 Bluetooth: Host: Add missing assigned numbers
Add missing assigned EIR/AD numbers.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-09 10:45:52 +01:00
René Beckmann
26758117d6 net: mqtt-sn: Add MQTT-SN library
This commit adds an implementation of MQTT-SN v1.2.
The specification is available on oasis-open.org:
https://www.oasis-open.org/committees/download.php/66091/MQTT-SN_spec_v1.2.pdf

The following things are missing in this implementation:
- Pre-defined topic IDs
- QoS -1 - it's most useful with predefined topics
- Gateway discovery using ADVERTISE, SEARCHGW and GWINFO messages.
- Setting the will topic and message after the initial connect
- Forwarder Encapsulation

Signed-off-by: René Beckmann <rene.beckmann@grandcentrix.net>
2022-11-09 10:43:00 +01:00
Hubert Miś
6f450fdf18 ipc: separate icmsg core from ipc_service backend
icmsg library was implemented as a ipc_service backend. It is a simple
library with minimal feature set. To preserve its simplicity while
adding more features it is useful to introduce separated ipc_service
backends with added features. To reuse most of the icmsg code for the
simplest backend and other including more features, the core of icmsg
is separated from the simplest ipc_service to an icmsg module which
can be used by multiple backends.

Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
2022-11-09 10:41:43 +01:00
Seppo Takalo
83d79b5996 net: lwm2m: We should not use read callbacks to generate new data
When read callbacks are used, it bypasses LwM2M engine data
handling and therefore LwM2M observation cannot work properly.

Read callbacks should be used only on special cases.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2022-11-09 09:16:22 +00:00
Christoph Schnetzler
c364721796 net: sockets: Prevent compiler error if warnings being treated as errors
If gcc compiler option -Werror is used the warning,

declared inside parameter list will not be visible outside of this
definition or declaration [-Werror]

is treated as error, for

sockets_internal.h:18:28: ‘struct net_context’
sockets_internal.h:19:32: ‘struct zsock_pollfd’
fdtable.h:108:17: ‘struct k_mutex’

Signed-off-by: Christoph Schnetzler <christoph.schnetzler@husqvarnagroup.com>
2022-11-09 09:15:32 +00:00
Sam Hurst
df4c31ba98 usb-c: Correct the PDO enum type name
Table 6-7, in the USB PD3.1 spec, is labeled Power Data Object.
The enum that represents the table 6-7 values should be
labeled similarly.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-11-08 10:46:40 +01:00
Lingao Meng
93709a7359 Bluetooth: Mesh: Add specific number of keys & groups
Since Mesh Spec and Mesh model sayes, some model no need
groups and no need keys, such as Config Server, but the
current implementation, all model use same configuration,
which cause some ram ext comsume.

So that, change to specific way, but will consume more footprint size.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2022-11-08 10:45:15 +01:00
Tom Burdick
e3d877f811 rtio: Userspace support
Add support for userspace with RTIO by making rtio and rtio_iodev
k_objects. As well as adding three syscalls for copying in submissions,
copying out completions, and starting tasks with submit.

For the small devices Zephyr typically runs on one of the most important
attributes tends to be low memory usage. To maintain the low footprint of
RTIO and its current executor implementations the rings are not shared with
userspace. Sharing the rings it turns out would require copying submissions
before working with them to avoid TOCTOU issues.

The API could still support shared rings in the future so that a
kernel thread could directly poll, copy, verify, and start the submitted
work. This would require a third executor implementation that maintains its
own copy of submissions similiar to how io_uring in Linux works.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-11-08 10:44:03 +01:00
Jose Alberto Meza
b479c66e62 include: drivers: peci: Add missing subsystem macro
Add subsystem macro for peci driver API.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-11-08 09:42:27 +00:00
Chris Friedt
4bae4f426f include: posix: move pthread impl detail to posix_internal.h
The `struct pthread` and `enum pthread_state` are actually
implementation details specific to Zephyr.

Let's limit the scope where that level of detail is visible.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2022-11-07 09:09:11 -05:00
Marc Herbert
44d9f2ce5c toolchain: more detailed #error messages on endianness mismatch
Recent commit ae123c9bd1 ("toolchain: Ensure that Kconfig endianness
matches the compiler's") added an endianness check which immediately
revealed a problem when compiling with -DSPARSE=y

Finding which values were wrong was a typical pre-processor
nightmare. Avoid this nightmare to anyone in a similar situation again
by adding more tests and #error messages.

- Before:
```
west build  -p -b intel_adsp_cavs25 samples/hello_world/ -- -DSPARSE=y

zephyr/toolchain.h: error: "Endiannes mismatch"
```

- Now:
```
zephyr/toolchain.h: error: "Kconfig/toolchain endianness mismatch:"
zephyr/toolchain.h: error: "CONFIG_LITTLE_ENDIAN but __ORDER_BIG_ENDIAN__"
```

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-11-07 09:49:11 +01:00