Commit graph

15409 commits

Author SHA1 Message Date
Hou Zhiqiang
71e86891c3 arm64: update the value type of macro MPIDR_AFFLVL_MASK
Fix build warning: left shift count >= width of type.
Such as in the case: mpidr & (MPIDR_AFFLVL_MASK << MPIDR_AFF3_SHIFT)

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2023-05-24 13:16:21 -04:00
Aleksander Wasaznik
92fcd9ef40 Bluetooth: Host: Add L2CAP seg_recv API
This is an alternative API for the L2CAP receive functionality. It
allows an application the receive L2CAP segments directly and manage
credits explictly. The API is guarded by an experimental kconfig option.

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/57485

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-05-24 13:15:14 -04:00
Carlo Caione
b87534a5fc barriers: builtin: Check for GCC-ism
__atomic_thread_fence() is GCC-ism. When supported by the compiler
(C11), use atomic_thread_fence() instead.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Carlo Caione
6f3a13d974 barriers: Move __ISB() to the new API
Remove the arch-specific ARM-centric __ISB() macro and use the new
barrier API instead.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Carlo Caione
20165f576f barriers: arm64: Implement arch-specific barrier op
For barrier_isync_fence_full() use the assembly code to generate a
proper ISB instruction.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Carlo Caione
fb8fde8fc1 barriers: arm: Use CMSIS for ISB
As done before, falls back onto CMSIS also for ISB.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Carlo Caione
a8662b1f02 barriers: Introduce barrier_isync_fence_full()
Some architectures have a special barrier instruction that is used to
ensure that any previously executed context-changing operations, such as
writes to system control registers, have completed by the time the
instruction is done.

In the ARM world this is called ISB. For all the other architectures
falls back to a compiler barrier.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Carlo Caione
cb11b2e84b barriers: Move __DSB() to the new API
Remove the arch-specific ARM-centric __DSB() macro and use the new
barrier API instead.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Carlo Caione
7cbb1f8b82 barriers: arm64: Move to arch-specific barriers
The compiler is not able to emit a proper DSB operation for ARM64. Move
to the arch-specific implementation and use assembly code instead.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Carlo Caione
62ffacba9b barriers: arm: Use CMSIS for DSB
As done for DMB, use CMSIS for DSB as well.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Carlo Caione
8e4e53154e barriers: Introduce barrier_dsync_fence_full()
Some architectures have a kind of fence that is "stronger" than the
regular data memory barrier. Introduce a new API for that.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Carlo Caione
2fa807bcd1 barriers: Move __DMB() to the new API
Remove the arch-specific ARM-centric __DMB() macro and use the new
barrier API instead.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Carlo Caione
4512712cd6 barriers: arm: Use CMSIS instead of built-in functions
For ARM (AArch32) we fall back on the CMSIS implementation that it is
supposedly more refined.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Carlo Caione
74a942e673 barriers: Introduce barrier operations
Introduce a new API for barrier operations starting with a general
skeleton and the implementation for barrier_data_memory_fence_full().

Select a built-in or an arch-based implementation according to new
Kconfig symbols CONFIG_BARRIER_OPERATIONS_BUILTIN and
CONFIG_BARRIER_OPERATIONS_ARCH.

The built-in implementation falls back on the compiler built-in
function using __ATOMIC_SEQ_CST as it is done for the atomic APIs
already.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Florian Grandel
681e2145b8 net: l2: ieee802154: fix struct padding
The IEEE 802.15.4 stack was checked with pahole(1).

Minor changes were introduced to remove unnecessary struct
padding where possible.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-05-24 16:41:57 +02:00
Florian Grandel
32e1213b0c net: l2: ieee802154: improve inline documentation
Over time, some non-standard concepts and extensions were introduced
into the stack (in KConfig, in drivers, in the internal API and into the
implementation) which makes introduction of additional standard-
compliant extensions like TSCH (and others) unnecessarily difficult.

To introduce extensions like TSCH it is required for the IEEE 802.15.4
stack to become more structurally aligned with the standard again which
will be the focus of some of the upcoming preparatory changes.

One way to check and prove standard compliance is to reference the
standard from within the source code. This change therefore introduces
inline references to the IEEE 802.15.4-2020 standard wherever possible.
Deviations from the standard are documented with TODO or deprecation
labels to be addressed in future changes.

In the future, new code introduced to the IEEE 802.15.4 stack should
be documented and reviewed for standard-compliance to avoid further
divergence. Most importantly:
* MAC/PHY configuration (via net mgmt, radio API, devicetree or
  KConfig) should always be directly linked to well-defined MAC/PHY
  PIB attributes if visible to the MAC API or the end user.
* Net management/shell/radio API commands should have a documented
  reference to the corresponding MLME action from the standard.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-05-24 16:41:57 +02:00
Silviu Petria
5096aa1c00 Bluetooth: Audio: Add TMAS and two TMAP samples
Add implementation of the Telephony and Media Audio Service, as well as
two sample applications.

tmap_central reflects a smartphone implementing the Unicast Media Sender
and Call Gateway TMAP roles.

tmap_peripheral reflects an earbud implementing the Unicast Media
Receiver and Call Terminal TMAP roles.

Upon connection, tmap_central starts an audio stream using CAP Initiator
APIs.

CCP, MCP and VCP are discovered and used to send example commands.

Future improvements: 2-earbud support, add TMAP Broadcast roles,
update with new CAP Acceptor/Commander APIs as they become available

Signed-off-by: Silviu Petria <silviu.petria@nxp.com>
2023-05-24 16:39:38 +02:00
Gerard Marull-Paretas
e05df8faf1 drivers: regulator: adp5360: initial version
Add a new regulator driver for Analog Devices ADP5360. While it is a MFD
device, only support for BUCK/BUCKBOOST regulators is added in this
patch.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-24 11:54:30 +00:00
Qipeng Zha
bc3ea1bb99 drivers: spi: add SPI device statistics
Enable below statistics for SPI by follow Zephyr STATS subsystem,
    rx_bytes, tx_bytes, transfer_error.

and add SPI_DEVICE_DT_DEFINE helper macro to define SPI device.

Signed-off-by: Xiaolu Sun <xiaolu.sun@intel.com>
Signed-off-by: Qipeng Zha <qipeng.zha@intel.com>
2023-05-23 22:15:25 -04:00
Gerard Marull-Paretas
5181b53bc5 bluetooth: mesh: fix some Doxygen groups location
Bluetooth mesh had many groups defined as top level Doxygen groups.
Place all of them to `bt_mesh`. Also removed redundant `@brief` entries,
and placed the block at the right location (just below extern "C"
entry), as well as uniform spelling of "Mesh".

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-23 22:10:06 +02:00
Carles Cufi
5b308c0fe1 device: Fix doc syntax for DEVICE_DT_GET_ONE
Add the missing verb.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-05-23 11:58:44 -05:00
Oscar Goldring
c26f44ced3 drivers: uart: fix compiler warnings in uart emulator
Fix compiler warnings in the UART emulator header file. By explicitly
adding the include for the Zephyr device.

Signed-off-by: Oscar Goldring <oscar@goldring.dev>
2023-05-23 16:46:23 +02:00
Dawid Niedzwiecki
aa0c0727b4 mgmt: ec_host_cmd: add config to create a dedicated thread
Add a config to decide if a new dedicated thread for Host Command is
created during initialization.

If not, the ec_host_cmd_task has to be called by another thread to
handle host commands.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-05-23 16:19:53 +02:00
Wojciech Slenska
330a2f84c7 net: wifi: Fix cpp compatibility
Fixed comparison between signed(int16_t) and unsigned(size_t) variables.

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2023-05-23 13:03:09 +02:00
Benedikt Schmidt
940ddba8bd drivers: dac: make output buffer for STM32 DAC configurable
If an operational amplifier is used on the DAC output it is
preferrable to disable the DAC output buffer.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-05-23 13:02:25 +02:00
Flavio Ceolin
020df54ba4 xtensa: mmu: Initial implementation
Initial support for Xtensa MMU version 3. It is using a two level page
table based on fact that the page table is in the virtual space.  Only
the top level (page directory) is wired mapped in the TLB to avoid
second level page miss.

The mapped memory is completely fragmented in multiple sections, maybe
we find a better way in future.

The exception handler is where we effectively map the memory, the way it
works is:

1) SW try to access some memory address
2) The address is not mapped, so the MMU will try the auto-refill,
   looking the page table
3) The page table contents is not mapped (remember, just the top-level page
   is mapped)
4) An exception will be triggered, in the exception we try to read the
   portion of the page table that maps the original address
5) The address is not mapped, so the MMU will try again the auto-refill.
   This time though, the address is mapped by the top level page that is
   properly mapped. (The top-level page maps the page table itself).

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-05-23 08:54:29 +02:00
Daniel Leung
cadc51cb8b xtensa: add functions to determine if pointer is in cached area
This adds two functions to determine if a pointer is in
the cached region or uncached region.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-05-23 08:54:29 +02:00
Florian Grandel
693edd0607 drivers: counter: improved guard period doc
The previous counter documentation said:

> Absolute alarm cannot be set further in future than top_value
> decremented by the guard period. Relative alarm ticks cannot
> exceed current top value (see @ref counter_get_top_value).

And further down:

> Absolute value cannot exceed: (now + top_value - guard_period)
> % top_value.

The first documentation snippet is not wrong but may be confusing.
On casual reading one might assume that the absolute tick value
should not be set above top minus guard. Users have to understand
driver internals to follow that explanation.

The second documentation snippet is only correct when counting
downwards (which several drivers don't). When counting upwards,
the given formula is wrong.

This commit improves and corrects the documentation.

Fixes: #57594

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-05-22 16:33:42 +02:00
Emil Gydesen
d770e2af13 Bluetooth: Audio: Remove BT_CODEC_MAX_DATA_LEN > 0 checks
The minimal value of BT_CODEC_MAX_DATA_LEN is 1, so it
is always > 0.

Includes to audio.h in shell bt.c was removed as audio.h
should only be included if BT_AUDIO=y.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-22 15:25:54 +02:00
Matthias Breithaupt
d2163bc0b9 net: DHCPv4: Add option callback
In certain scenarios, it may be necessary to get values of additional
options from the application layer. With this patch, this can be
accomplished by registering a callback with the DHCP client.

This change has been tested using the posix build in qemu.

Signed-off-by: Matthias Breithaupt <m.breithaupt@vogl-electronic.com>
2023-05-22 15:25:40 +02:00
Emil Gydesen
3074c72d79 Bluetooth: BAP: Move endpoint discovery to new callback
Add a new endpoint callback that is used to report the found
ASEs during BAP discovery, rather than calling
the discovery callback with optional values.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-22 15:24:28 +02:00
Emil Gydesen
1c304d9d23 Bluetooth: BAP: Move pac record discovery to new callback
Add a new pac_record callback that is used to report the found
PAC records during BAP discovery, rather than calling
the discovery callback with optional values.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-22 15:24:28 +02:00
Emil Gydesen
5d498d78ad Bluetooth: BAP: Remove bt_bap_unicast_client_discover_params
Remove the BAP unicast client specific discover parameter struct.
This make the BAP discover work more similar to the other
profiles.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-22 15:24:28 +02:00
Emil Gydesen
ffca5f9b2f Bluetooth: BAP: Remove dir from BAP discovery parameters
The direction has been moved to a function parameter instead,
and we keep a local copy of the value in the stack instead.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-22 15:24:28 +02:00
Emil Gydesen
1199e46e0b Bluetooth: BAP: Remove num_eps from BAP discover params
The field is not required and is no longer used.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-22 15:24:28 +02:00
Emil Gydesen
0b10498fb1 Bluetooth: BAP: Remove num_caps from BAP discover params
The field is not needed and no longer used.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-22 15:24:28 +02:00
Emil Gydesen
11f5f3b080 Bluetooth: BAP: Move uni cli discov err to callback
Move the err field from the discover parameters to
the callback.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-22 15:24:28 +02:00
Emil Gydesen
39406a4843 Bluetooth: BAP: Move uni cli discover callback
Move the unicast client discover callback from the
parameters to the callback structure.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-22 15:24:28 +02:00
Jerzy Kasenberg
ce4018511f drivers: adc: add adc support for Smartbond devices
Renesas Renesas SmartBond(tm) have two ADC blocks:
GPADC and SDADC.
This change adds drivers for both.
Each ADC supports only one channel setup, drivers allow
to have multiply channels in sequence. Switching
between ADC sources in done in software.

GPADC has 10 bit resolution (accuracy can be increase
with oversampling). Values up to 3.6V can be measured
on selected pins. V30 and VBAT1 can also be measured.
SDADC has 14 bit resolution and can take measurements
from 8 pins (single of differential) and VBAT.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2023-05-22 12:41:42 +02:00
Jamie McCrae
a232d5afeb mgmt: mcumgr: Improve group error descriptions
Improves group error descriptions by adding comments which will be
rendered into the documentation.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-05-22 12:25:25 +02:00
Gerard Marull-Paretas
dacb3dbfeb iterable_sections: move to specific header
Until now iterable sections APIs have been part of the toolchain
(common) headers. They are not strictly related to a toolchain, they
just rely on linker providing support for sections. Most files relied on
indirect includes to access the API, now, it is included as needed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-22 10:42:30 +02:00
Peter Rowley
66c568e300 drivers: fuel_gauge: sbs_gauge: Add support for buffer registers
The buffer registers (chemistry, manufacturer name, device name) were
not implemented. Implemented by adding a new api interface for
retrieving buffer properties. fuel_gauge_get_block_property has been
added, and uses a memory buffer allocated in the app in order to
store the fuel gauge information.

Signed-off-by: Peter Rowley <perowle@microsoft.com>
2023-05-19 16:39:25 -04:00
Miika Karanki
d8166e813b json: add json_calc_encoded_arr_len
Analog to json_obj_encode vs. json_calc_encoded_len which
calculates the object len using json_obj_encode, introduce
json_calc_encoded_arr_len which calculates the length using
json_arr_encode. That is needed when the object to be encoded
is array on the root level.

Signed-off-by: Miika Karanki <miika.karanki@vaisala.com>
2023-05-19 19:52:04 +00:00
Vincent Geneves
d4d20c5826 drivers: sensor: add helper functions to convert float
These helper functions can be used to avoid dependency to double
type and save some space in ROM.

Signed-off-by: Vincent Geneves <vgeneves@kalray.eu>
2023-05-19 13:18:05 -05:00
Peter Rowley
ff36548616 drivers: fuel_gauge: Add support for RSOC and ASOC
Current driver only allows state-of-charge.  Adding relative-state-
of-charge and absolute-state-of-charge to differentiate between the
different types.  Updated sbs and max drivers to support new enum.
Discussed in issue #57523

Signed-off-by: Peter Rowley <perowle@microsoft.com>
2023-05-19 13:40:19 -04:00
Tom Burdick
a560d47078 i2c: Add RTIO support to the I2C API
Adds the needed calls and macros required to enable supporting RTIO
with an I2C bus.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-05-19 16:10:51 +02:00
Tom Burdick
38dc226ff5 rtio: Add iodev specific flags
Flags are needed for i2c support to enable arbitrary stop and restart
setups where in a single i2c transaction the caller would like to direct
the hardware to either send a stop or not after any particular read/write.

These can be reused more generally to direct devices to use different
methods of performing the operations on an operation by operation basis
such as perhaps a hint to use a polling, interrupt, or dma read/write.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-05-19 16:10:51 +02:00
Jeronimo Agullo
e64129d910 video: mt9m114: YUV pixel format support
Added YUV pixel support to mt9m114 camera

Signed-off-by: Jeronimo Agullo <jeronimoagullo97@gmail.com>
2023-05-19 15:45:50 +02:00
guotong ma
2539ac942a drivers: spi: Adapt to new SPI dt-spec macros
The SPI dt-spec macros has been modified to make it compatible with C++.
But there are still a macros that haven't been modified completely.
And the macros are not available.
So I modified them to Adapt the new SPI dt-spec macros.

Signed-off-by: guotong ma <maguotong66@gmail.com>
2023-05-19 09:39:48 +02:00
Jamie McCrae
a476eeb8ec mgmt: mcumgr: grp: os_mgmt: Use new error for invalid format
Uses the new error system to report an error if the user provides
an invalid format for the OS info command.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-05-18 13:31:19 +02:00