Commit graph

15409 commits

Author SHA1 Message Date
Ajay Parida
55ed46ff6d net: wifi_mgmt: Updated TWT setup response status
Updated TWT setup response status. Removed un-necessary
error strings, enum and values updated as per f/w.

Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
2023-03-03 12:43:43 +01:00
Chris Friedt
5e9d3c7522 posix: fnmatch: correct (many) compliance issues
* add opening and closing braces around several blocks
* convert dos line endings to unix
* move assignments out of conditionals
* ensure adequate spacing after control blocks

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-03-03 17:40:14 +09:00
Chris Friedt
e79e203a6c posix: fnmatch: add extern C decls when using C++
All public API headers should have ifdef extern C declarations
symbols defined in the global namespace.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-03-03 17:40:14 +09:00
Chris Friedt
f923441146 lib: posix: move fnmatch from lib/util to lib/posix
The `fnmatch()` function is specified by POSIX and should be
a part of `lib/posix`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-03-03 17:40:14 +09:00
Tom Burdick
3998f9f898 rtio: Shareable lock-free iodevs
By using an mpsc queue for each iodev, the iodev itself is shareable across
contexts. Since its lock free, submits may occur even from an ISR context.

Rather than a fixed size queue, and with it the possibility of running
out of pre-allocated spots, each iodev now holds a wait-free mpsc
queue head.

This changes the parameter of iodev submit to be a struct containing 4
pointers for the rtio context, the submission queue entry, and the mpsc
node for the iodevs submission queue.

This solves the problem involving busy iodevs working with real
devices. For example a busy SPI bus driver could enqueue, without locking,
a request to start once the current request is done.

The queue entries are expected to be owned and allocated by the
executor rather than the iodev. This helps simplify potential
tuning knobs to one place, the RTIO context and its executor an
application directly uses.

As the test case shows iodevs can operate effectively lock free
with the mpsc queue and a single atomic denoting the current task.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-03 09:18:09 +01:00
Tom Burdick
e9f6eef791 rtio: Add lock free MPSC queue for iodevs and more
Adds a lock free/wait free MPSC queue to the rtio subsystem.

While the SPSC ring queue is fast and cache friendly it doesn't
work for all scenarios. Particularly the case where multiple rtio contexts
are attempting to work with a single iodev. An MPSC queue works perfectly
in this scenario.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-03 09:18:09 +01:00
Tom Burdick
22ff4d6102 rtio: Remove unused spsc initializer params
SPSC initializer macro had unused parameters defined and documented. Remove
those as they are unused.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-03 09:18:09 +01:00
TOKITA Hiroshi
47f52bba42 drivers: regulator: add support for RaspberryPi Pico regulator.
Add support for rpi_pico regulator.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-03-02 21:14:34 +01:00
Jay Vasanth
e56721b8f0 dts: gpio: Add Microchip XEC GPIO macros for use in device tree
Microchip XEC devices specify GPIO pin using octal numbering and
organize pins in banks of 32. Chip documentation does not use
bank naming rather naming each pin by its octal number. This has
led to the developer having to calculate the bit position of a pin
in its 32-bit bank when a specifying the pin for GPIO usage. We
created a set of defines for all possible GPIO pins that specify
the DT GPIO bank name used in the chip level DTSI files and the
bit position in that bank.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-03-02 13:52:03 +01:00
Simon Frank
b50838c66f fb: cfb: add API to set font kerning
Font kerning was used but it was not possible to change it.
Also, font_idx was set to zero twice in init.

Signed-off-by: Simon Frank <simon.frank@lohmega.com>
2023-03-02 13:51:55 +01:00
Grant Ramsay
026105c883 drivers: pinctrl: Add pinctrl support for TI K3 devices
K3 is a common architecture used between different TI
processor families

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-03-02 13:50:06 +01:00
Andy Ross
d18484b03a toolchain/gcc: Limit use of _Static_assert
This C11 feature doesn't work when building C++ code, but the C++
version is based on C++11's static_assert(), which we don't have in
-std=c++98 either.

Signed-off-by: Andy Ross <andyross@google.com>
2023-03-01 19:42:32 -05:00
Andy Ross
76e57f8e3c sys/cbprintf: Limit C++ rvalue references to compatible standards
This feature didn't appear until C++11, so don't expose our wrapper
for it in C++98.

Signed-off-by: Andy Ross <andyross@google.com>
2023-03-01 19:42:32 -05:00
Andy Ross
cc46968c97 drivers/gna: No empty structs
Empty structs are incompatible when building with C++, which specifies
their size as 1 byte.  Technically they are illegal in C; GCC has
always supported them as an extension, but with a size of *zero*
bytes.

The upshot is that we can't have them in headers that may be presented
to a C++ compiler.  Add a placeholder field.

We only get the resulting compiler warning with -std=c++98 it seems
like, which is why this went undetected.

Signed-off-by: Andy Ross <andyross@google.com>
2023-03-01 19:42:32 -05:00
Andy Ross
3843cebb9e include/sys/util: Rework _Generic & C++11 usage
The recently-added LOG2 family of macros were implemented using either
a compile-time expanded C11 _Generic expression or a C++11 constexpr
template.  As it happens, Cadence xt-xcc supports neither of these
constructs, and integration for the next-generation xt-clang[1] hasn't
arrived yet.

Let's back out to a more portable (heh) implementation using gcc
__typeof__.  This keeps the advantage of expanding to a single
__builtin_clz() for common case usage and is result-compatible with
the new LOG2/LOG2CEIL/NHPOT.

The one downside is that the generic code was able to be used in a
constant context, something that statement expressions can't do.  So
the resulting macros are (like the earlier LOG2CEIL was) unhygienic
and multi-expand their arguments.  I added a warning to this effect in
the docs.

[1] Which is still based on an ancient clang tree, but more recent
than their GCC 4.2 compiler.

Signed-off-by: Andy Ross <andyross@google.com>
2023-03-01 19:42:32 -05:00
Maureen Helm
a87e4c254b drivers: sensor: Document blocking behavior of sample fetch functions
Updates the sensor driver API documentation to explicitly state that
sample fetch functions block until the fetch operation is complete.

Fixes #53728

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-01 19:09:56 -05:00
Nazar Palamar
dcf52fd566 drivers: pinctrl: Add Infineon CAT1 Pin controller driver
Added initial version of Infineon CAT1 Pin controller driver.
Added initial version of binding file for Infineon CAT1 Pinctrl driver.
Added initial version of dt header for Infineon CAT1 pinctrl driver.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2023-03-01 11:44:57 +01:00
Erwan Gouriou
b934ad8cb9 include: dt-bindings: F4 clocks: Add PLLI2S as source clock
Add PLLI2S R as I2S source clock.
For now I2S_CKIN (fixed clock) is not supported.

This change only consider F401 and compatible PLL I2S implementations.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-03-01 08:56:05 +01:00
Erwan Gouriou
cb633ae7de dts: bindings: clocks: Add binding for F4 PLL I2S
Provide dts binding for F4 PLL I2S.
This PLL share input source and input M diviso with F4 Main PLL.

Only one output clock (PLLR) is supported for now.
This PLL could be found on STM32F401 parts for instance.

Additionally, provide related header definitions.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-03-01 08:56:05 +01:00
Emil Gydesen
084ddf9552 Bluetooth: Audio: Remove deprecated requirement from audio API
Removed statement about the QoS having to be symmetrical
for two streams using the same CIS, as that requirement
was recently removed.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-28 14:44:34 +01:00
Aleksander Wasaznik
30926ec0d3 Bluetooth: Host: Fix doc; bt_id_create does not accept pub addr
`bt_id_create` does not accept public addresses, but the phrasing that
is removed in this change can be interpreted as "replace the public
address with a different public address". This was confusing users, so
it will be removed.

The intended meaning of the original sentence may have been "use the
provided address for BT_ID_DEFAULT, instead of using the public
address". Amending the sentence to something like that was considered.
But, there was no consensus on the usefulness of this addition, so it
was left out for brevity.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-02-28 13:42:58 +01:00
Dawid Niedzwiecki
2d0a784c41 subsys/mgmt/ec_host_cmd: rework Host Command support
Rework the Host Command support. It includes:
-change API to backend
-change a way of defining rx and tx buffers
-fix synchronization between the handler and backend layer
-simplify the HC handler

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-02-28 10:42:23 +01:00
Dawid Niedzwiecki
b2674a4b34 subsys/mgmt/ec_host_cmd: rename peripheral to backend
Follow naming pattern in the subsystems(logging or shell) and name
the layer between generic handler and peripheral driver "backend".

The name doesn't suit that well to the SHI backend, because there isn't
SHI API itself and the SHI interface is used only for the host
communication. So the backend code includes the peripheral driver itself.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-02-28 10:42:23 +01:00
Dawid Niedzwiecki
e734adfb78 subsys/mgmt/ec_host_cmd: update directory structure
The Host Commands can be used with different transport layers e.g. SHI
or eSPI. The code that provides the peripheral API and allows sending
and receiving Host Commands via different transport layers is not
actually drivers of a peripheral, so move it to the
subsys/mgmt/ec_host_cmd folder.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-02-28 10:42:23 +01:00
Jun Qing Zou
755f0b7d27 net: tftp: Add client context
Use client context to seperate buffer usage.
Use new `TFTP_EVT_DATA` event to send data to application.
Use new `TFTP_EVT_ERROR` event to report error to application.
Update `tftp_get()` and `tftp_put()` API to use the client context.

Signed-off-by: Jun Qing Zou <jun.qing.zou@nordicsemi.no>
2023-02-28 10:29:30 +01:00
Sylvio Alves
fde5281541 dt-bindings: add esp32s3 signals
Adds esp32s3 related gpio sigmap, intmux and clock related.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-02-27 19:41:33 +01:00
Immo Birnbaum
92a93e7eeb dt-bindings: fix MDC clock divider bindings for Xilinx GEM
The original implementation of the GEM's device tree binding
implied that:
1) on the UltraScale+, the MDC clock divider is applied to
the LPD_LSBUS_CLK. According to the most recent documentation,
this is not the case, instead, the MDC divider is applied to
the IOU_SWITCH_CLK.
2) any MDC divider greater than 32 is reserved to the Zynq-7000
(in the driver itself, accessibility of the larger dividers was
also #ifdef'd), as the Zynq's MDC clock source, the cpu_1x
clock, can have significantly higher frequencies than the
UltraScale's LPD_LSBUS clock.

The respective documentation in the device tree binding header
file is hereby fixed.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2023-02-27 11:36:19 +01:00
Jonathan Rico
3486f133e9 Bluetooth: host: prevent registering services in the wrong context
There is a touchy spot where registering a service might result in sending
service changed indications that are not necessary. This is due to a race
condition between the SC work and the GATT DB hash being calculated.

Only allow users to call this API when we know it is safe:
- either before BT is initialized
- or after settings have been loaded (and hash calculated)

Fixes #54047

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-02-27 10:48:15 +01:00
Martí Bolívar
2bf1ce9137 devicetree: fix DT_PROP_HAS_NAME doxygen example
The node identifier is missing a DT_NODELABEL() around the node label.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-02-26 09:17:54 -05:00
Joshua Lilly
bcc8466c41 lib: hashmap: Fix typo in hash_map_sc.h
Adds the STATIC to the definition of SYS_HASHMAP_SC_DEFINE_STATIC.

Signed-off-by: Joshua Lilly <jgl@fb.com>
2023-02-24 16:06:18 -05:00
Tomasz Moń
509c033c1d usb: device_next: new USB Mass Storage implementation
Introduce new USB Mass Storage Bulk-Only Transport implementation
written from scratch. Main goal behind new implementation was to
separate USB and SCSI parts as clearly as possible.

Limited set of SCSI disk commands is implemented in separate source code
file that is internal to USB device stack. While it should be possible
to use the SCSI implementation by other components there is currently no
other user besides USB MSC and therefore SCSI header is kept private.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-02-24 15:19:20 +01:00
Johann Fischer
c51744c6ee usb: device_next: use consistent nil descriptor name
Use a consistent nil_desc name for the descriptor that
terminates a class (function) descriptor.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-02-24 14:02:37 +01:00
Yuval Peress
0e003cdbee test: verify accel/gyro data for icm42688
Verify the conversion of register values in both accel and gyro to
sensor_value for the icm42688.

Signed-off-by: Yuval Peress <peress@google.com>
2023-02-24 11:50:10 +01:00
Maciej Baczmanski
a468246373 net: ieee802154_radio: new API for continuous carrier wave transmission
Added new API function to start continuous carrier wave transmission

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2023-02-24 09:26:01 +01:00
Johann Fischer
d17119c612 usb: device_next: add feature endpoint halt/clear state update API
Add USB device class API to notify class instances that an endpoint
has been halted or cleared due to a feature request.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-02-24 09:15:55 +01:00
Andries Kruithof
b02ce97dd0 Bluetooth: controller: update bluetooth version to 5.4
The Bluetooth 5.4 specification was recently released, and has a new
version identifier (0x0D or decimal 13) assigned to it in the
Bluetooth Assigned Numbers.

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-02-24 09:13:18 +01:00
Gerard Marull-Paretas
a1e983fef0 drivers: pinmux: drop driver class
Pinctrl is the new pinmux.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-23 16:56:04 -05:00
Hubert Miś
2c3863160d ipc: multi-endpoint icmsg cleanup
The multi-endpoint backend of the ipc_service subsystem contains two
roles with separated implementations: initiator and follower. There
was many code duplications for both roles. This patch introduces a new
IPC library: icmsg_me containing common code extracted from both roles
and encapsulating access to common data fields.

Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
2023-02-23 10:46:25 +01:00
Goh Shun Jing
9ecfa4decc drivers: serial: uart_altera: add driver
Add driver for altera avalon uart core.

Signed-off-by: Goh Shun Jing <shun.jing.goh@intel.com>
2023-02-23 09:26:33 +01:00
Henrik Brix Andersen
eb9bbf4490 drivers: can: sja1000: move public header file to public include path
Move the can_sja1000.h header file to the public
include/zephyr/drivers/can/ include path. This allows writing out-of-tree
SJA1000 based driver front-ends.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-02-23 09:00:34 +01:00
Henrik Brix Andersen
36bffb20ae drivers: can: move CAN utility function to public header
Rename the can_utils_filter_match() utility function to
can_frame_matches_filter(), move it to the public
include/zephyr/drivers/can.h header file, and add a missing mismatch for
standard (11-bit) ID frames passing extended (29-bit) filters.

This allows using the utility function in out-of-tree CAN drivers.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-02-23 09:00:12 +01:00
Marcin Niestroj
2b4cbe9e29 kernel: remove init_abort from _static_thread_data
Commit d823f88e3b ("kernel: move _static_thread_data to ROM") intended to
remove init_abort member from `struct _static_thread_data`, but instead it
just removed it from Z_THREAD_INITIALIZER() initializer.

Remove init_abort, which is a leftover.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-02-23 08:47:53 +01:00
Peter Mitsis
4ab9be98df canbus: isotp: Fix typo in function descriptions
Fixes the return value descriptions for functions isotp_recv() and
isotp_recv_net() as they mistakenly referred to ISOTP_WAIT_TIMEOUT
instead of ISOTP_RECV_TIMEOUT.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-02-22 15:09:58 -05:00
Chris Friedt
0bda7b30df lib: os: add hashmap support
* Add a flexible Hashmap API
* Add a Separate-Chaining Hashmap Implementation
* Add a Open-Addressing Linear Probe Hashmap Implementation
* Add a C-Wrapper for `std::unordered_map` for benchmarking

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-02-22 19:14:05 +01:00
Chris Friedt
b75df60f0b lib: os: add hash function specification and implementation
Hash functions are necessary for Hashmaps (a.k.a. Hash Tables).

* Create a flexible hash function interface
* Implementation 1. Murmur3
* Implementation 2. djb2
* Kconfig option for system-wide 32-bit hash

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-02-22 19:14:05 +01:00
Chris Friedt
c26fc959e6 sys: util: Power-of-Two utilities
* remove previous `LOG2CEIL()` from `<zephyr/toolchain/common.h>`
  - `LOG2CEIL()` is not used in-tree by any C or C++ source
  - only used are in `.ld` files
  - however, it is built-in to both GNU and LLVM linkers
* sys: util: provide LOG2() and LOG2CEIL() macros
  - calculate `log(x)` and `ceil(log(x))`, respectively
  - both are compile-time `const` / ok for `constexpr`
  - also runtime efficient with `__builtin_clz()`
  - `LOG2()`, `NUMBITS()`, and `IS_POWER_OF_TWO()` macros
    contributed by @JordanYates
  - `LOG2CEIL()` contributed by @oyvindronningstad
* sys: util: provide Next-Highest Power-of-Two macro `NHPOT()`
  - calculate `next = pow(2, ceil(log(x)/log(2)))`
  - leverages `LOG2CEIL()`

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-02-22 19:14:05 +01:00
Seppo Takalo
bf49540a8d net: lwm2m: Add const qualifier to many pointers
Various functions, mostly concerning time-series cache, were not
using const pointer while they still did not modify the content.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-02-22 14:26:20 +01:00
Aaron Massey
6cdef0894f drivers: fuel_gauge: kernel drivers use syscalls
The fuel gauge API doesn't make use of syscalls with device drivers, which
is not congruent with Zephyr's security model.

Correct the fuel gauge API to only allow access to fuel gauge device
drivers functionality via syscalls to keep with Zephyr's security model.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-02-22 08:51:55 +01:00
Aaron Massey
7d83bf7d54 drivers: fuel_gauge: Rename API struct
Fuel gauge API struct type is currently named battery_driver_api, this is
inaccurate as the API struct represents functions for interacting with fuel
gauge drivers in particular.

Rename the API struct type to fuel_gauge_driver_api to clearly signal its
functionality.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-02-22 08:51:55 +01:00
Andriy Gelman
8a97da056b drivers: dma: Add infineon xmc4xxx dma support
Adds dma drivers for xmc4xxx SoCs.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-02-21 21:15:53 +01:00