Commit graph

15409 commits

Author SHA1 Message Date
Henrik Brix Andersen
590cd5cb72 drivers: can: rename can_state enumerations
Rename the can_state enumerations to contain the word STATE to make their
meaning more clear:
- CAN_ERROR_ACTIVE  => CAN_STATE_ERROR_ACTIVE
- CAN_ERROR_WARNING => CAN_STATE_ERROR_WARNING
- CAN_ERROR_PASSIVE => CAN_STATE_ERROR_PASSIVE
- CAN_BUS_OFF       => CAN_STATE_BUS_OFF

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 21:41:11 +00:00
Henrik Brix Andersen
7e3814b262 drivers: can: expand return values reported by the CAN timing functions
Expand the error return values reported by the CAN timing calculation
functions to be able to distinguish between an an out of range
bitrate/sample point, an unsupported bitrate, and a resulting sample point
outside the guard limit.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 21:39:16 +00:00
Andriy Gelman
f4dc5ac565 linker: Use a different macro to set vma for the noinit section
The two macros are the same in this context. But an SoC may
redefine the GROUP_LINK_IN() macro which could introduce an
unintended change in this part of the linker script.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-08-18 16:05:49 +02:00
Andriy Gelman
4e90efa79f linker: set __rom_region_end via an offset from __rom_region_start
Currently __rom_region_end points to the virtual memory address, while
__rom_region_start points to the load memory address. In most cases the
two address spaces will be the same. In the case of the infineon xmc4xxx
series they can be different because flash can be read via a different
cachable address space.

Evaluate __rom_region_end as an offset from __rom_region_start to fix this
possible issue.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-08-18 16:05:49 +02:00
Andriy Gelman
8d5acea57b linker: make sure the macro arguments both point to the vma
If the rom region can be accessed via a virtual memory address,
then __rodata_region_end will point to the vma, while __rom_region_start
is the lma. This patch makes sure the two values are in the vma address
space.

This is in prepartion for a future patch which will allow the rom to be
accessed via a virtual memory address.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-08-18 16:05:49 +02:00
Andriy Gelman
671cfa5488 linker: align the lma to 4 bytes
This is needed when the flash can be accessed via a different vma
address as in the case of the infineon xmc4xxx series where 0xc000000
is the uncached start address and 0x8000000 is the cached start address.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-08-18 16:05:49 +02:00
Fabio Baltieri
8c55073d59 gpio: move gpio_cmsdk_ahb.h from drivers to include/drivers
Move gpio_cmsdk_ahb.h out of drivers/gpio and into include/drivers/gpio.
This is used by few board files so it should be in include.

This allows to remove few odd
"zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)".

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-18 12:13:14 +00:00
Carlo Caione
ae82071ae4 arch: Rework cache-related Kconfig symbols
We have now:

- CPU_HAS_{D,I}CACHE: when the CPU has support for d-cache and i-cache

- {D,I}CACHE: to enable / disable d-cache and i-cache

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-08-18 11:30:49 +00:00
Mariusz Skamra
541d946d10 Bluetooth: audio: Add HAS client support for preset switching
This adds client support for switching the active preset along with bsim
tests implementation.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-08-18 12:46:27 +02:00
Piotr Kmiecik
2ce143a3e5 drivers/counter: return 64-bit value
Extend the API to add the possibility
to return value of 64-bit counter.

Signed-off-by: Piotr Kmiecik <piotrx.kmiecik@intel.com>
2022-08-18 12:42:30 +02:00
Fabio Baltieri
0cba9cb8e9 drivers: sensor: max17055: add VFOCV support
Add support for reading the VFOCV register, which contains the model
estimated open circuit voltage for the cell.

Link: https://pdfserv.maximintegrated.com/en/an/AN6358.pdf
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-18 12:39:20 +02:00
Emil Gydesen
a301afca93 samples: Bluetooth: Restrict Audio TX length to SDU for unicast audio
Restrict the unicast audio samples to not send more data than
the configured SDU.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-08-18 12:33:44 +02:00
Emil Gydesen
9e9ea2146c Bluetooth: ISO: Add check for maximum ISO SDU size
Verify that the HCI ISO data packet is smaller than
the maximum SDU size we support, based on the group
settings.

Since we do not yet support fragmentation we also
verify that the data length is smaller than the
HCI ISO buffer size.

For the ISO peripheral is it not possible to know
the SDU, and we are forced to not send any value larger
than the PDU size.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-08-18 12:33:44 +02:00
Jackson Cooper-Driver
09cb88edcf ipc_service: Add ipc_service_deregister_endpoint function
In the case that an endpoint goes down, it needs to be deregistered
from the ipc_service for cleanup. This function deregisters the endpoint
from the ipc_rpmsg instance and sets the endpoint to zero.

Signed-off-by: Jackson Cooper-Driver <jackson.cooper---driver@amd.com>
2022-08-18 12:32:21 +02:00
Emil Gydesen
0277682a33 Bluetooth: ISO: Add check for pending ISO connections
Per the HCI spec it is not possible to send the
HCI_LE_Create_CIS command while an outstanding request
is pending. To avoid failing the command we can
check and verify if any ISO connections are in the
pending state.

Since multiple ISO channels can be connected
in a single request, the solution implemented was
to iterate over all ISO connections and see if there was
any unicast ISO channels in the connecting state.

It also checks for the encryption pending state, as
we should not start the encryption procedure if we know
that the connect ISO command cannot be completed afterwards.

This adds a new return value to bt_iso_chan_connect,
and decided to properly document the return values the
function can return.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-08-18 12:30:58 +02:00
Andrei Emeltchenko
cedc1e38f3 pcie: Add Interrupt command status
Add PCIE_CONF_CMDSTAT_INTERRUPT flag.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-08-18 10:19:49 +02:00
Henrik Brix Andersen
27eb12ed48 net: socketcan: decouple SocketCAN and CAN controller headers
Decouple the zephyr/net/socketcan.h and zephyr/drivers/can.h header files
by moving the SocketCAN utilities to their own header.

This is preparation for including the SocketCAN types defined in
socketcan.h in a native posix (Linux) SocketCAN driver context without name
clashes.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 10:19:29 +02:00
Henrik Brix Andersen
626c117cd9 net: socketcan: fix SocketCAN MTU definition
SocketCAN transfers an entire "struct socketcan_frame", not just the
embedded payload data. Fix the MTU to reflect this.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 10:19:29 +02:00
Henrik Brix Andersen
ef1e492032 net: socketcan: SocketCAN supports classic CAN, not CAN-FD
SocketCAN does not support CAN-FD data lengths of up to 64 bytes
payload. Decouple the maximum supported SocketCAN data length from the
maximum supported CAN controller data length.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 10:19:29 +02:00
Henrik Brix Andersen
d1d48e8304 net: socketcan: rename SocketCAN header from socket_can.h to socketcan.h
Rename the SocketCAN header from socket_can.h to socketcan.h to better
match the naming of the functionality.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 10:19:29 +02:00
Henrik Brix Andersen
b40a8cb9fd net: socket: can: rename utility functions
Rename the SocketCAN utility functions to reflect the new naming of the CAN
controller API and SocketCAN API data types.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 10:19:29 +02:00
Henrik Brix Andersen
13c75417ba drivers: can: remove z prefix from public CAN API types
Remove the "z" prefix from the public CAN controller API types as this
makes them appear as internal APIs.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 10:19:29 +02:00
Henrik Brix Andersen
d159947443 net: socket: can: prepend SocketCAN data types with socketcan
Rename the SocketCAN data types to "socketcan_*" in preparation of renaming
the low-level CAN controller API data types.

This breaks the naming compatibility with the similar SocketCAN data types
from the Linux kernel, but Zephyr and Linux SocketCAN are not 100%
compatible anyways (only the structure fields are compatible, extended
functionality such filtering, error reporting etc. are not).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 10:19:29 +02:00
Henrik Brix Andersen
fe80c1676d drivers: can: move socketcan types and functions to socketcan header
Move the SocketCAN data types and helper functions from
zephyr/drivers/can.h to zephyr/net/socket_can.h as these are not used by
the low-level CAN controller driver API.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 10:19:29 +02:00
TOKITA Hiroshi
8a8e893bd2 dts: arm: rpi_pico: Adding spi configurations to rp2040
Add spi0 and spi1 configuration to rp2040.

spi0 and spi1 are declared as compatible with
"raspberrypi,pico-spi" and "arm,pl022".
"raspberrypi,pico-spi" is just inherited from
"arm,pl022" and "reset-device"

spi0 and spi1 declare as compatible with "raspberrypi,pico-spi"
and "arm,pl022".
"raspberrypi,pico-spi" is just inheriting "arm,pl022" and
"reset-device" for declaring the 'reset' property,
with no additional property and implementation.

Add also pinctrl macros to dt-bindings header.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2022-08-18 10:18:16 +02:00
Peter Mitsis
f86027ffb7 kernel: pipes: rewrite pipes implementation
This new implementation of pipes has a number of advantages over the
previous.
  1. The schedule locking is eliminated both making it safer for SMP
     and allowing for pipes to be used from ISR context.
  2. The code used to be structured to have separate code for copying
     to/from a wating thread's buffer and the pipe buffer. This had
     unnecessary duplication that has been replaced with a simpler
     scatter-gather copy model.
  3. The manner in which the "working list" is generated has also been
     simplified. It no longer tries to use the thread's queuing node.
     Instead, the k_pipe_desc structure (whose instances are on the
     part of the k_thread structure) has been extended to contain
     additional fields including a node for use with a linked list. As
     this impacts the k_thread structure, pipes are now configurable
     in the kernel via CONFIG_PIPES.

Fixes #47061

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2022-08-17 19:31:25 +02:00
Abe Levkoy
14d1fca276 emul.h: Remove EMUL_DEFINE, EMUL_REG_NAME
These macros now have more conventionally named replacements, and the
old names are unused.

Part of #45976.

Signed-off-by: Abe Levkoy <alevkoy@google.com>
2022-08-17 15:47:52 +00:00
Abe Levkoy
9f5b29cfe4 emul: Define EMUL_DT_DEFINE, EMUL_DT_INST_DEFINE
Define these macros similarly to their DEVICE_*_DEFINE counterparts.

Part of #45976.

Signed-off-by: Abe Levkoy <alevkoy@google.com>
2022-08-17 15:47:52 +00:00
Abe Levkoy
1370dfc7f4 emul: Add EMUL_DT_GET
Implement EMUL_DT_GET, analogous to DEVICE_DT_GET. Add a test.

Signed-off-by: Abe Levkoy <alevkoy@google.com>
2022-08-17 15:47:52 +00:00
Abe Levkoy
874a847bc8 emul: Expose struct emul objects
Give struct emul objects defined by EMUL_DEFINE external linkage.
Generate a struct emul prototype for each node in the device tree in
emul.h.

Define EMUL_DT_NAME_GET and deprecate EMUL_REG_NAME, which was only used
in EMUL_DEFINE.

This partially addresses #45976 by making it possible to statically
refer to struct emuls.

Signed-off-by: Abe Levkoy <alevkoy@google.com>
2022-08-17 15:47:52 +00:00
Abe Levkoy
eba8d6d18f emul.h: Fix includes
Include devicetree.h, whose contents are already used in this file. Sort
included headers.

Signed-off-by: Abe Levkoy <alevkoy@google.com>
2022-08-17 15:47:52 +00:00
Daniel Leung
7dc20978e3 lib: os: cbprintf: fix typo exteral -> external
The cbprintf formatter cbvprintf_exteral_formatter_func has a typo
in it with a missing 'n'. So add it.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-08-17 08:08:46 +00:00
Tim Cooijmans
4c285fc53c drivers: lora: Add support for setting sync-word and iq-inverted
Add support for setting sync-word and iq-inverted in lora_modem_config. By
being able to set the sync-word it's possible to send "raw" public-network
packets using lora_send and using iq-inverted both uplink and downlink
messages can be sent.

Signed-off-by: Tim Cooijmans <timcooijmans@gmail.com>
2022-08-16 18:06:18 +02:00
Tim Cooijmans
b85fdf57a4 drivers: lora: Add documentation for the lora_modem_config struct.
Adds documentation for the fields in lora_modem_config.

Signed-off-by: Tim Cooijmans <timcooijmans@gmail.com>
2022-08-16 18:06:18 +02:00
Mariusz Skamra
cc86b9213c Bluetooth: conn: Extend bt_conn_info with security information
This extends the bt_conn_info with security information. This is needed
by LE Audio profiles to check if security requirements are met.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-08-16 12:19:43 +02:00
Mariusz Skamra
391a26138a Bluetooth: conn: Move bt_security_t definition
This moves bt_security_t definition to be used later in bt_conn_info.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-08-16 12:19:43 +02:00
Mariusz Skamra
cc37266742 Bluetooth: conn: Add const modifier to conn
The bt_conn_get_security and bt_conn_enc_key_size do not
modify the conn thus the parameter can be guarded with const modifier.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-08-16 12:19:43 +02:00
Evgeniy Paltsev
961df14f39 ARC: Check that ISR and exception stacks are proper aligned
CONFIG_ISR_STACK_SIZE and CONFIG_ARC_EXCEPTION_STACK_SIZE are
used in arc asembler code without C wrapper on them with following
manner:

---------------------------->8----------------------------
/#define INIT_STACK z_interrupt_stacks
/#define INIT_STACK_SIZE CONFIG_ISR_STACK_SIZE

	mov_s sp, INIT_STACK
	add sp, sp, INIT_STACK_SIZE
---------------------------->8----------------------------

In result we can get stack unaligned if we have
CONFIG_ISR_STACK_SIZE or CONFIG_ARC_EXCEPTION_STACK_SIZE
values unaligned. There is no point to have unaligned stack
size - so let's check against such configurations in
compile time.

Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2022-08-16 08:25:51 +00:00
Wolfgang Puffitsch
eb684905ea device.h: Do not generate "okay" devicetree nodes if DT is unsupported
The macro DT_FOREACH_STATUS_OKAY_NODE is only available if devicetree
is supported. Using it for platforms that do not support devicetree
causes compilation errors.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2022-08-15 11:10:51 -07:00
Christoph A Schnetzler
6fc4bb9486 kernel: Prevent Wundef
prevent `Wundef` warnings from occurring due to
missing CONFIG_ symbols and __cplusplus.

Signed-off-by: Christoph A Schnetzler <Christoph.Schnetzler@husqvarnagroup.com>
2022-08-15 14:36:47 +02:00
Anas Nashif
f991fe0197 xcc: do not call ASSERT in CODE_UNREACHABLE
230ddd9a7f added unreachable path hint for assertion failure. Xcc does
not support __builtin_unreachable and this was defined as a call to
ASSERT, which generated some recursion.

Replace the definition with __builtin_trap() to work around this issue.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-08-12 14:40:26 -04:00
Henrik Brix Andersen
c11326300f drivers: can: remove option for configuring CAN-FD max DLC
Remove the Kconfig option for configuring the maximum value of the CAN-FD
Data Length Code in order to ensure standard compliance.

Allowing users to configure the max DLC allows the user to save a number of
bytes per CAN frame in RAM, but it also renders the Zephyr CAN-FD
implementation non-compliant with the CAN-FD standard.

There are no guarantees that a Zephyr CAN-FD node will not receive a CAN
frame with a DLC higher than the Kconfig limit, which opens up for all
sorts of bugs when trying to handle received CAN-FD frames.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-12 14:15:10 +01:00
Gerard Marull-Paretas
be21b45522 drivers: spi: fix sample syntax
Upcoming versions of breathe highlight code embedded in Doxygen blocks.
In this case, the Devicetree fragment contained invalid syntax leading
to Sphinx warnings.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-12 11:04:26 +02:00
Fabio Baltieri
87e148e0aa Restore "device.h: rework the device_extern.h mechanism"
This reverts commit 5b2ba9aaeb, restoring
commit 0224f2c508.

Restore the original change now that the underlying issue has been fixed
in 6cfb18686e.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-12 07:45:01 +01:00
Fabio Baltieri
5b2ba9aaeb Revert "device.h: rework the device_extern.h mechanism"
This reverts commit 0224f2c508.

Seems to be breaking CI for few qemu platforms.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-11 17:21:46 -05:00
Tom Burdick
a45ece6984 i2c: Adds i2c_transfer_async API for I2C
i2c_transfer_async is the asynchronous version of i2c_transfer where
the completion of the transfer is notified to the caller using a callback.

This can be used in conjuction with the common callbacks and datatypes
in async.h for directly doing an async transfer with an IPC object
to notify a thread.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-08-11 14:12:13 -04:00
Gerard Marull-Paretas
d322adc66f devicetree: s/devicetree_unfixed/devicetree_generated
Because the fixup files do not exist anymore, stop using "unfixed"
naming in favor of "generated".

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-11 12:17:02 +02:00
Gerard Marull-Paretas
b2520b09a7 devicetree: drop support for dts_fixup.h files
Devicetree fixup files existed previous to the current stable Devicetree
API. While they served their purpose, they are no longer necessary nor
used in-tree. This patch drops support for this legacy feature.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-11 12:17:02 +02:00
Anas Nashif
b1074152b0 intel_adsp: move z_soc_irq_* declarations
Move prototype declaration to include/zephyr/arch/xtensa/irq.h.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-08-10 14:30:45 -04:00
Krishna T
dace99ebdd wifi_mgmt: Add support for frequency bands
Channels are not unique across bands, they need to be interpreted along
with frequency band. Add a separate band parameter that supports 2.4, 5
and 6 GHz bands.

Also, 6GHz has maximum channel of 233 (as of now), so, change the
maximum channel to that, this is a global maximum, per-band channel
validation is left to the offload driver as that depends on regulatory
rules (not a simple maximum check).

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2022-08-10 16:05:09 +02:00