Commit graph

15409 commits

Author SHA1 Message Date
Guillaume Lager
ac298bcde7 shell: Fix dictionary command naming
Add the handler function's name to the generated
sub command handler. Without it, it's not possible
to generate to dictionary matching items in a file.

Fixes #42398

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2022-02-04 11:14:21 +01:00
Martí Bolívar
f86f6e0025 devicetree: clocks: fix a docstring
Fix the formatting and what looks like a copy/paste error
in the DT_CLOCKS_CTLR_BY_NAME doxygen docstring.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-02-03 14:19:16 -06:00
Alexander Mihajlovic
bd4ddec0c8 usb: Add macro for user defined string descriptors
The new macro USBD_STRING_DESCR_USER_DEFINE works like
USBD_STRING_DESCR_DEFINE with the exception of being
ordered strictly after it. The new macro is needed to
ensures that user defined string descriptors can be added
without disturbing the order of string descriptors
defined by the usb subsystem.

Signed-off-by: Alexander Mihajlovic <a@abxy.se>
2022-02-03 14:57:42 +01:00
Kim Bøndergaard
5bed77a611 sys: sys_heap: extern "C" was missing
In order to use functions orginating from C libs in C++ context, their
definitions must be declared as "C" functions

Signed-off-by: Kim Bøndergaard <kim@fam-boendergaard.dk>
2022-02-03 08:23:16 -05:00
Yonatan Schachter
fd59038312 drivers: pinctrl: Added pinctrl driver for RPi Pico
Added a pinctrl driver for the Raspberry Pi Pico series

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2022-02-02 16:23:35 +01:00
Christopher Friedt
f2d675b7c5 doc: spinlock: ensure spinlock api is added to doxygen
Previously, `k_spin_lock()` and friends had broken links
in html docs.

Fixes #42373

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2022-02-02 08:57:14 -05:00
Carles Cufi
280309e636 Bluetooth: host: Document skip range in bt_le_per_adv_sync_param
The skip field in the bt_le_per_adv_sync_param structure did not
document the acceptable range. Add it, directly from the
specification.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-02-02 11:29:27 +01:00
Henrik Brix Andersen
5dba2138bf drivers: can: deprecate can_write() API wrapper function
Deprecate the can_write() API wrapper function in favor of using
can_send() directly.

The can_write() API wrapper function:
- Does not support CAN-FD data lengths.
- Auto-selects between standard/extended CAN identifiers based on the
  CAN ID (something which should be selected by the caller as the
  selection affects filters on the receiving end).
- Does not support callbacks for frame transmission results.
- Has no in-tree users.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-01 11:31:05 -05:00
Andrzej Puzdrowski
23b6e51e73 drivers/flash: remove flash_write_protection API
This API was designed to be removed in Zephyr 2.8

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-02-01 10:46:28 +01:00
Andrzej Głąbek
aa3b86600d drivers: flash: nrf_qspi_nor: Fix setting of the base clock divider
On nRF53 Series SoCs, the highest SCK frequencies can only be achieved
when the HFCLK192M clock divider is changed from the default /4 setting.
Such change results in increased power consumption, so the divider needs
to be changed only for periods when it is actually necessary.
This commit modifies the driver behavior so that it changes the divider
only when a QSPI bus operation is performed.
However, when XIP accesses to the flash chip are also used, it may be
needed to keep the divider changed even when the driver is idle so that
the XIP access speed is not reduced, hence a custom API function that
allows forcing this is introduced for the driver.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-02-01 10:31:50 +01:00
Henrik Brix Andersen
fab291779a drivers: can: use @deprecated for deprecated API functions
Use the @deprecated Doxygen command for documenting alternatives to
deprecated CAN API functions and macros.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-31 14:42:54 -06:00
Arnaud Mouiche
2eae4a3b72 c++: fix missing extern "C" closing }
Fix a failure to compile a C++ file including "pm/device_runtime.h"
A quick grep on all .h shows that net/tftp.h also needs to be fixed.


Signed-off-by: Arnaud Mouiche <arnaud.mouiche@invoxia.com>
2022-01-31 14:00:03 -06:00
Henrik Brix Andersen
2aed5a1237 drivers: can: remove CAN_BUS_UNKNOWN CAN controller state
The CAN_BUS_UNKNOWN CAN controller state is only used to indicate that
the current CAN controller state could not be read.

Remove it and change the signature of the can_get_state() API function
to return an integer indicating success or failure.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-28 10:05:29 +01:00
Aleksander Wasaznik
c65bb791bf Bluetooth: Host: Update API docs on GATT request failures
Document the deadlock avoidance in ATT request queueing.

Add more precise description of the callback and how long the argument
must be kept valid for.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-01-27 16:04:24 +01:00
Vinayak Kariappa Chettimada
3c6fa016b1 Bluetooth: Host: Added new LE Feature Support bit masks
Added new LE Feature Support bit mask as documented in
Bluetooth Spec. v5.3 Vol 6, Part B, Section 4.6 Feature
Support.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-01-27 14:01:54 +01:00
Emil Gydesen
cf06fa85f2 Bluetooth: Audio: Add BAP broadcast sink support
Add support for the BAP broadcast sink role. This role
allows a device to sync to a broadcast ISO stream.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-27 12:01:34 +02:00
Emil Gydesen
ab87e0a2ba Bluetooth: Audio: Add BAP broadcast source support
Add the BAP broadcast source implementation. This role
allows a device to broadcast ISO data.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-27 12:01:34 +02:00
Emil Gydesen
03862b3db5 Bluetooth: Audio: Add BAP unicast server support
Add the Basic Audio Profile (BAP) unicast server
functionality. This allows a device to act as the
unicast server role, which can accept unicast streams
initiated by a unicast client.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-27 12:01:34 +02:00
Krzysztof Chruscinski
a40ca6fd1c logging: printk: Fix LOG_PRINTK for v2
Fixed a dependency from printk.h to logging headers which in
certain configurations could lead to circular dependencies.
Cleaned up printk.c to call z_log_vprintk from vprintk.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-27 10:02:21 +01:00
Martí Bolívar
3543df52cc api: move a devicetree.h layering violation to drivers/spi.h
The DT_SPI_DEV_CS_GPIOS_DT_SPEC_GET macro belongs in drivers/spi.h,
not devicetree.h.

It is creating a struct gpio_dt_spec, but the devicetree.h API does
not (other than in this case) and should not depend on structures that
are defined in the GPIO API. This is because the GPIO API already
depends on the devicetree.h API, so making a dependency in the reverse
direction creates a needless circular dependency.

This macro should have been added to the drivers/spi.h API from the
beginning. Move it there under a new name, SPI_CS_GPIOS_DT_SPEC_GET.

We haven't created a Zephyr release with
DT_SPI_DEV_CS_GPIOS_DT_SPEC_GET in it, so there is no need to go
through the stable API change process for devicetree.h to deprecate
and eventually remove it. We can just remove it directly.

Fixes: #42149
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-01-26 16:08:18 +01:00
Robert Lubos
df09440926 net: igmp: Update function stubs when module is disabled
Current solution throws an error during build if IGMP module is
disabled (statement with no effect).

Update the stubs in a similar fashion as other network modules implement
them.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-01-26 10:50:24 +01:00
Daniel Leung
2f5976d674 kernel: C++ friendly version of Z_WORK_USER_INITIALIZER
Officially, designated initializers for struct are not valid
until C++20. Strangely enough, XCC only complains about this
particular initializer. So use anonymous struct initializer
instead.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-25 21:17:04 -05:00
Daniel Leung
df6e80a097 clock: Z_TIMEOUT_NO_WAIT initializer to {0}
Clang under XCC does not like Z_TIMEOUT_NO_WAIT's initializer
to be simple "{}". So change it to "{0}", which is functionally
the same and XCC-Clang likes it.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-25 21:17:04 -05:00
Daniel Leung
0e73ffcfe2 cpp: BUILD_ASSERT() uses static_assert() iff C++11
The #if to use static_assert() for BUILD_ASSERT() only checks
whether compiler is in C++ mode, but does not check what
C++ standard is being used. Since static_assert() is only
valid since C++11, for compilers not supporting C++11 (XCC...),
this will result in error. So add the correct #if to also
check for C++ standard being used.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-25 21:17:04 -05:00
Robert Lubos
697f415bbf net: sockets: Use struct timeval provided by libc
Instead of redefining own `struct zsock_timeval` type at the socket
layer, use a standard type provided by libc. This prevents the
compliation errors when application includes both, `net/socket.h` and
standard C header defining `struct timeval` (sys/time.h).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-01-21 13:17:43 -05:00
Piotr Pryga
6590ffd330 samples: Bluetooth: df: Fix too early per sync create timeout
Periodic advertising synchronization create had a timeout set
to fixed value of 10 seconds. BT 5.3 Core specification defines
synchronization timeout as 6 consecutive periodic advertising
events. When advertiser set the periodic interval to be more than
1.6 second it was possible the application timeout is reached
before time allowed by BT Core specification.

Changed implementation of timeout to depend on the periodic
advertising interval.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-21 19:32:17 +02:00
Hake Huang
710c3ca3ef bindings: ccmv2: add more SAI clock supports in RT11xx
add RT11xx SAI1-4 clock supports in dts binding

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-01-21 11:26:45 -06:00
Ryan Erickson
c6ace45a6c net: lwm2m: add uCIFI Battery object (3411)
Add the uCIFI Battery object to support
monitoring a devices battery.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-01-21 11:32:08 -05:00
Piotr Pryga
2feedecdac Bluetooth: host: df: Add handling of HCI_LE_CTE_Request_Failed
There were no handling of HCI_LE_CTE_Request_Failed event.
The commit adds missing implementation. An application will
be notified about failed request by cte_report_cb. It is the
same callback that is used for reporting collected CTE IQ
samples. The same callback was used to avoid creation new callback.
To give an application possibility to distinguish between regular
IQ samples report and request failed additional member err was added
to bf_df_conn_iq_samples_report structure.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-21 09:30:23 -05:00
Piotr Pryga
85c4176446 Bluetooth: controller: Add handling of CTE request failed
CTE request control procedure may failed due to rejection by
peer device or due to receive of LL_CTE_RSP PDU without CTE.
These events has to be reported to host by HCI_LE_CTE_Request_Failed.

The commit adds missing functionalit.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-21 09:30:23 -05:00
Piotr Pryga
0086e86153 Bluetooth: hci: Fix wrong CTE request interval type
Request interval is a number of connection events that
is used to periodically run CTE request control procedure.
BT 5.3 Core Specification defines it as 2 octets long.
It had wrong type uint8_t. Changed to correct one uint16_t.

The commit also changes type of cte_rsp_en field of lll_df_conn_tx_cfg
to state that it is a boolean flag.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-21 09:30:23 -05:00
Nazar Palamar
c77a546f14 Bluetooth: hci: added HCI vendor-specific Setup function feature
- Added config BT_HCI_SETUP to enable HCI vendor-specific Setup feature,
- Added pointer to 'setup' function in bt_hci_driver structure.

BT_HCI_SETUP feature is useful when the BT Controller requires execution
of the vendor-specific commands sequence to initialize the BT Controller
before the BT Host executes a Reset sequence. To enable this feature the
CONFIG_BT_HCI_SETUP should be enable.

Fixes #41140

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2022-01-21 15:04:15 +02:00
Andy Ross
ca7024e1d6 arch/xtensa: Use ZSR assignments for the CPU pointer
Use the zsr.h assignments for the special register containing the
current CPU pointer.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-01-20 12:58:00 -05:00
Krzysztof Chruscinski
18165b1d49 logging: Fix tracking of buffered messages
Algorithm was failing in case when overflow mode was enabled
but allocation of new message failed. It could happen if message
size exceeded buffer size. Losing track of buffered messages
can lead to logging processing freeze.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-20 08:52:08 -05:00
Mahesh Mahadevan
aeabe6c70c driver: clock: Update MCUX Syscon clock control driver
1. Update to add support for Flexcomm8-13.
2. Fix the clock control driver, the enclosing #define
   was incorrect.
3. Identify HS_SPI port using the appropriate Register
   define

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-01-19 13:35:09 -06:00
Tom Burdick
669c4d1738 dma: Add host related dma transfer directions
DMA between a host os and processor (such as an x86 processor running
linux) and vice versa is used and supported by Intel's HDA DMA
Controller. This provides a method to transfer data, using hardware,
between the host and the local processor running Zephyr. The enums
added here are used to extend the dma_status direction enum
which provides information back to the DMA user and driver the
direction of the DMA transfer for a particular channel. This can
then be used, where needed, to add logic around the direction of the
transfer.

In addition to adding the two directions it adds enums to account for
cases where additional DMA directions that are IP and driver specific
may exist.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-01-19 14:13:36 -05:00
Antony Pavlov
0369998e61 arch: add MIPS architecture support
MIPS (Microprocessor without Interlocked Pipelined Stages) is a
instruction set architecture (ISA) developed by MIPS Computer
Systems, now MIPS Technologies.

This commit provides MIPS architecture support to Zephyr. It is
compatible with the MIPS32 Release 1 specification.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
2022-01-19 13:48:21 -05:00
Neil Armstrong
c65016b4d3 pcie: add Type 1 bridge config defines
Add config registers defines for the Type 1 bridge endpoints.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 13:37:36 -05:00
Neil Armstrong
43a47ce18a pcie: controller: add callback to get allocation base
When enumerating bridges, the allocated memory base and limit must be
programmed in the bridge config registers.

The base is programmed when starting enumerating the bridge and the
limit is programmed when all endpoints of the bridge and sub-bridges
are enumerated.

Add a second callback to get the base of the next allocation in
order to fill these base & limit values.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 13:37:36 -05:00
Flavio Ceolin
6ab08bc9fd pm: device: Additional note about on/off actions
Add a note to clarify that these actions are only used by power
domains to notify children.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-01-19 13:35:32 -05:00
Jordan Yates
7101899328 pm: device_runtime: init into PM_DEVICE_STATE_OFF
Add a function to tell runtime power management that the device is
starting in the off state instead of active or suspended.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-19 13:35:32 -05:00
Jordan Yates
3f7f8d8f75 pm: device: helper to query power domain
Adds a helper for devices to check if they are on a power-domain or not.
Drivers can use this information to determine if they will be turned on
at some point in the future, or if they are already turned on.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-19 13:35:32 -05:00
Jordan Yates
9e9fb319a7 pm: device: helper for running actions on children
Adds a helper function for running PM actions on child devices. A custom
implementation of `device_supported_foreach` is used as we don't
necessarily want the early exit behaviour of that function in the power
domain context.

The early exit behaviour can be obained through a return value in the
failure callback if that is desired.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-19 13:35:32 -05:00
Jordan Yates
79f382e96e pm: device: add action to turn device on
Adds `PM_DEVICE_ACTION_TURN_ON` to transition from `PM_DEVICE_STATE_OFF`
to `PM_DEVICE_STATE_SUSPENDED`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-19 13:35:32 -05:00
Flavio Ceolin
2e732dff6d pm: device: Make power domain optional
Add a Kconfig symbol to enable/disable power domain on Zephyr.
Disabling power domain save some memory / space.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-01-19 13:35:32 -05:00
Flavio Ceolin
ddfa048058 pm: Add power domain infra structure
Add support for power domains on Zephyr. Power domains are implemented
as simple devices so they can use the existent Zephyr API, for resume
and suspend sync and async and also reference count.

The pm subsystem will ensure that domains are resumed before and
suspended after devices using them. For device runtime power
management, every time the device is got or released the same actions
is done to the domain it belongs.

As domains are implemented as simple devices, it is totally acceptable
a domain belongs to another domain.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-01-19 13:35:32 -05:00
Henrik Brix Andersen
f5f93e5fba drivers: can: add error-warning state
Add CAN controller error-warning state and document the relationship
between CAN controller states and CAN controller RX/TX error counter
values.

Fixes: #21010

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-19 18:34:26 +01:00
Gerard Marull-Paretas
435213a753 drivers: remove redundant data/config casts
Some drivers explicitely casted data/config from void * to the
corresponding type. However, this is unnecessary and, in many drivers it
has been misused to drop const qualifier (refer to previous commits).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Krzysztof Chruscinski
ff6b5d979f soc: arm: nordic_nrf: nrf53: Add Synchronized RTC
Add a module which is responsible for getting offset between RTCs
used for system clock on NET and APP cores. After getting an offset
between NET and APP clocks, it can be used for logging timestamping
on NET core to ensure that timestamping is in sync on both cores.

Synchronization is done using PPI, IPM task and events and RTC
capture feature.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-19 17:46:28 +01:00
Krzysztof Chruscinski
ec9a32481b drivers: timer: nrf_rtc_timer: Add z_nrf_rtc_timer_capture_task_address_get
Add function for getting address of RTC capture task.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-19 17:46:28 +01:00