* 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>
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>
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>
SPSC initializer macro had unused parameters defined and documented. Remove
those as they are unused.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
`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>
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>
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>
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>
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>
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>
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>
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>
Use a consistent nil_desc name for the descriptor that
terminates a class (function) descriptor.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
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>
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>
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>
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>
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>
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>
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>
* 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>
* 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>
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>
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>
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>