Commit graph

8623 commits

Author SHA1 Message Date
Georgij Cernysiov 8a4b078c85 include: drivers: clock_control: stm32: fix xtpre
Correct DT property to set correct STM32_PLL_XTPRE value.
The driver bindings defined `xtpre` instead of used `xtre`
in the `DT_PROP` macro.
That allows to use F1 PLL clock with division by 2.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-02-08 10:20:53 -05:00
Bradley Bolen 643084de0b arch: arm: core: aarch32: Use cmsis functions
These functions help the code to be more self-documenting.  Use them to
make the code's intent clearer.

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
2022-02-08 07:35:43 -05:00
Krzysztof Chruscinski 3f56567b08 logging: Prevent multiple arguments evaluation
Logging v2 is utilizing complex preprocessing operations to
prepare message at compile time. Multiple operations are peformed
on log message arguments. However, it is expected that argument
will be evaluated only once (e.g. it can be a call to a function
with side effects). Adding additional layer which creates copies
of user arguments on stack and passes them to further processing.

Updated test for log_msg2 which is using internal macro which
got renamed.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-08 07:32:43 -05:00
Henning Fleddermann 3018279c30 net: lib: lwm2m: make pathstr parameter const correct
many functions in the lwm2m librarys api take a pathstr argument
that is never written to, so make it const

Signed-off-by: Henning Fleddermann <henning.fleddermann@grandcentrix.net>
2022-02-08 07:27:30 -05:00
Maureen Helm 5b2e447751 sys: heap_listener: Fix initializers for XCC toolchain
XCC (which is based on GCC 4.2) needs the initializer of one of the
union elements to be enclosed in brackets.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-02-07 10:50:12 -05:00
Erwan Gouriou a775606ae9 include: devicetree.h: Remove deprecated macros
These macros were deprecated in V2.6.0 release.
Remove them now.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-02-05 06:26:25 -05:00
Erwan Gouriou d5b8af024b include/devicetree: dma.h: Remove deprecated macros
These macros were deprecated in V2.6.0 release.
Remove them now.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-02-05 06:26:25 -05:00
Erwan Gouriou 9e36486df4 include/devicetree: io-channels.h: Remove deprecated macros
These macros were deprecated in V2.6.0 release.
Remove them now.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-02-05 06:26:25 -05:00
Erwan Gouriou 45c53e9508 include/devicetree: pwms.h: Remove deprecated macros
These macros were deprecated in V2.6.0 release.
Remove them now.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-02-05 06:26:25 -05:00
Erwan Gouriou 0a32afdd75 include/devicetree: clocks.h: Remove deprecated macros
These macros were deprecated in V2.6.0 release.
Remove them now.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-02-05 06:26:25 -05:00
Carles Cufi 7f6524949a lib: os: crc: Rework the crc16() implementation
As described in #42403, there was an issue with the existing crc16_ansi()
implementation, since it was not calculating the CRC-16-ANSI (aka
CRC-16-MODBUS). This is because the  existing crc16() function only
supported non-reflected input and output (and the CRC-16-ANSI requires
reflection on both) and also it did not seem to support correctly inial
seeds different from 0x0000 (and, again, the CRC-16-ANSI requires 0xffff
as an initial seed).

This commit replaces the existing crc16() with a functional pair,
crc16() and crc16_reflect(), that also work with any poly, any initial seed
and allow to select whether reflection is performed.
It also adapts crc16_ansi() so that it actually returns the correct CRC.

Fixes #42403.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-02-04 12:33:22 -05:00
Carles Cufi 2a5051f369 include: sys: crc: Clarify documentation of two crc functions
The crc16_ccitt and crc16_itu_t functions' documentation could lead to
slight misunderstandings because of the fact that, although they bear
those names, those functions are actually able to compute CRCs that bear
other names, depending on the inital seed provided and an optional XOR
on the result.
In order to avoid confusion, document thoroughly with links to the
standard reveng page that lists all existing CRCs.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-02-04 12:33:22 -05:00
Martí Bolívar baf2e7f3c5 api: gpio: add missing member docstrings for gpio_dt_spec
This makes the breathe output for this type useful.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-02-04 11:20:46 +01:00
Daniel Leung e2f109456c lib/os: cbprintf_packaged: add ability to use external formatter
This adds to the cbprintf_packaged library to allow external
formatters to be used by the way of callback. This will allow
logging backends to use their own formatter for output if
needed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-02-04 11:14:55 +01:00
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