Commit graph

8532 commits

Author SHA1 Message Date
Yuval Peress
e84a48d8b8 cbprintf: Fix unused arg warning
This was found when building with `-Wextra` enabled.

Signed-off-by: Yuval Peress <peress@google.com>
2021-12-14 11:47:13 -06:00
Yuval Peress
50a89ce287 zephyr: fix errors when building with -Wundef
Several points check the value of CONFIG_s without first checking that
they're defined. This causes an warning when adding -Wundef to the
build.

Signed-off-by: Yuval Peress <peress@google.com>
2021-12-14 11:47:13 -06:00
Yuval Peress
8aa2c3f3d1 sys: Fix warning for stripped const qualifier
This causes an issue when compiling with `-Werror=cast-qual`

Signed-off-by: Yuval Peress <peress@google.com>
2021-12-14 11:47:13 -06:00
David Leach
5e36939664 pm: device: fix comment reference to DT_INVALID_NODE
Comment block for Z_PM_DEVICE_DEFINE had an incorrect
reference to DT_INVALID_NODE. Using DT_NODE_INVALID
which isn't defined.

Signed-off-by: David Leach <david.leach@nxp.com>
2021-12-14 08:36:03 -06:00
Ederson de Souza
bdaac354f4 kernel: Bring back object tracking
When CONFIG_TRACING_OBJECT_TRACKING is enabled, the kernel will keep
lists of some objects (detailed below), so that debuggers or other tools
can keep track of them.

The lists of objects are:

struct k_timer *_track_list_k_timer;
struct k_mem_slab *_track_list_k_mem_slab;
struct k_sem *_track_list_k_sem;
struct k_mutex *_track_list_k_mutex;
struct k_stack *_track_list_k_stack;
struct k_msgq *_track_list_k_msgq;
struct k_mbox *_track_list_k_mbox;
struct k_pipe *_track_list_k_pipe;
struct k_queue *_track_list_k_queue;

Note that while CONFIG_TRACING is needed, one can always use
CONFIG_TRACE_NONE=y. Also, tracking will only be done for objects that
are also being traced (so, to prevent tracking of some type of object,
such as k_timer, just make CONFIG_TRACING_TIMER=n).

Some simple "sanity checking" tests are also added in this patch.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2021-12-14 07:42:31 -05:00
Lauren Murphy
c1711997bc debug: coredump: add xtensa coredump
Adds Xtensa as supported architecture for coredump. Fixes
a few typos in documentation, Kconfig and a C file. Dumps
minimal set of registers shown by 'info registers' in GDB
for the sample_controller and ESP32 SOCs. Updates tests.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2021-12-14 07:40:55 -05:00
Peter Mitsis
f8b76f3b03 kernel: add 'static' keyword to select routines
Applies the 'static' keyword to the following inlined routines:
    z_priq_dumb_add()
    z_priq_mq_add()
    z_priq_mq_remove()
As those routines are only used in one place, they no longer have
externally visible declarations.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2021-12-13 17:21:58 -05:00
Johann Fischer
02d1fd9ad7 linker: remove unused usb_data data section in RAM
Remove unused usb_data data section in RAM which is
replaced by iterable section usb_cfg_data.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 07:22:15 -06:00
Johann Fischer
b1356e969d include: usb: add iterable section in ram for usb_cfg_data
Add iterable section in ram for struct usb_cfg_data and
new makro USBD_DEFINE_CFG_DATA which should be used to
define usb_cfg_date structures.

Deprecate makro USBD_CFG_DATA_DEFINE.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 07:22:15 -06:00
Johann Fischer
dfb7a5952f include: usb: add alignment attribute to macro USBD_CFG_DATA_DEFINE
It could be observed on native_posix_64 platform that
without alignment attribute the usb_cfg_data structures
are placed with a gap or padding in specified RAM section.
This breaks the possibility to iterate over the structures.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 07:22:15 -06:00
Carles Cufi
944a02d18a include: Add a macro to check pointer alignment
Add a new macro, IS_PTR_ALIGNED() that verifies if a pointer is aligned
sufficiently for a particular data type provided as an argument.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Kent Hall
c67b44c96a drivers: counter: Added get_freq to API
Optional counter API function which allows for a driver to determine
counter frequency at runtime; if set, this supersedes whatever is set
statically in the counter_config_info struct.

Signed-off-by: Kent Hall <kjh2166@columbia.edu>
2021-12-09 19:55:17 -05:00
Piotr Pryga
a26ee7ce73 Bluetooth: host: Add IQ reports handing in DF connecte mode
Add reception of IQ sample report from controller.
Add applications notification about received reports.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-12-09 19:44:15 -05:00
Piotr Pryga
f18637fe30 Bluetooh: host: Add CTE RX and sample enable for conn mode
Add enable of CTE reception and sampling in connected mode.

The implementation allows an application to decide what type
of CTE is expected to be reported. Bluetooth Core specification
does not provide such functionality, so it is provided as part
of host implementation. Host will filter out all reports for not
enabled CTE types.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-12-09 19:44:15 -05:00
Gerard Marull-Paretas
4ec7cf33dc include: remove deprecated <power/power.h> header
<power/power.h> was deprecated in 2.6 in favor of <pm/pm.h>.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-09 14:43:06 -05:00
Gerard Marull-Paretas
0a1e8dc44b include: remove deprecated <power/reboot.h> header
<power/reboot.h> was deprecated in 2.6 in favor of <sys/reboot.h>

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-09 14:43:06 -05:00
Emil Gydesen
815dd27d8c Bluetooth: buf: Update BT_BUF_RX_SIZE with ISO
The BT_BUF_RX_SIZE did not take the CONFIG_BT_ISO_RX_MTU
into account. Add BT_BUF_ISO_RX_SIZE which
depend on CONFIG_BT_ISO and use that for the
BT_BUF_RX_SIZE macro.

Furthermore, move the BT_BUF_RX_COUNT macro definitions
into buf.h and update that to account for ISO RX as well.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-12-09 12:38:12 -05:00
Henrik Brix Andersen
1fb6c6387e drivers: can: fix doxygen comment formatting
Fix the formatting of a few doxygen comments.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-09 12:37:40 -05:00
Henrik Brix Andersen
1004901bb3 drivers: can: exclude deprecated APIs from the documentation
Move the deprecated CAN APIs to the bottom of the include file and
exclude them from the documentation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-09 12:37:40 -05:00
Henrik Brix Andersen
f499559434 drivers: can: deprecate the use of CAN-specific error return values
Deprecate the use of CAN-specific error return values and replace them
with standard errno values.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-09 12:37:40 -05:00
Krzysztof Chruscinski
9ddc45884d logging: Improve instance logging filtering
Instance logging allows to set independent severity level for
each instance (static and runtime). However, so far when runtime
filtering was disabled, static level was not taken into account
and instance messages were only compile time filtered based on
module level.

Improved logging macros to use static instance level to determine
if message shall be created. It enables instance filtering also
when runtime filtering is disabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-09 16:56:40 +01:00
Jordan Yates
7b2a388d1d linker: remove manual name specification
As memory region names are now derived purely from devicetree, remove
the `name` parameter from `DT_REGION_FROM_NODE_STATUS_OKAY`. Name is
`zephyr,linker-region` if it exists, otherwise the node path.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-12-09 16:23:03 +01:00
Jordan Yates
024ecdd672 devicetree: LINKER_DT_NODE_REGION_NAME added
Adds a macro to convert a devicetree node to the name of a linker memory
region.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-12-09 16:23:03 +01:00
Mark Holden
1a697ccf59 coredump: add support for RISC-V
This adds the necessary bits in arch code, and Python scripts
to enable coredump support for RISC-V

Signed-off-by: Mark Holden <mholden@fb.com>
2021-12-08 08:54:32 -05:00
Guillaume Lager
972e5d0274 sensor: eeprom: Add TMP116 EEPROM access
eeprom access is supported by using
either custom or eeprom API

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-12-08 07:51:46 -06:00
Daniel DeGrasse
423dff8a51 drivers: pca9420: Added voltage level support for PCA9420
This commit adds support for editing the voltage levels on the buck
regulators on the PCA9420 PMIC

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:27:44 -05:00
Daniel DeGrasse
130f6eb816 drivers: regulator: add i2c regulator driver
This commit adds a generic i2c regulator driver, and enables the NXP
PCA9420 PMIC IC using this driver. The regulator driver also exposes an
additional API in include/drivers/regulator/consumer.h, which allows
drivers to implement support for adjusting voltage levels and current
limits, if their device supports it.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:27:44 -05:00
Daniel DeGrasse
b18aefdfd3 dts: rt685: enabled flexcomm15
the RT685 contains an additional flexcomm peripheral, that supports
only I2C. This commit adds this peripheral to the device tree,
and enables pins and clocks for flexcomm15.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:27:44 -05:00
Henrik Brix Andersen
deb1b455b9 drivers: can: improve API documentation
Improve the CAN driver API documentation:
- Reorder API declarations and organize them into logical groups.
- Add doxygen strings where missing.
- Improve and unify wording of existing doxygen strings.
- Unify naming of callback function pointers as "callback".
- Unify naming of user-specified callback function arguments as
  "user_data".
- Instances and pointers to struct zcan_frame are named "frame",
  not "msg", to avoid confusion with the CAN message queue support.
- Check for __DOXYGEN__ to include documentation for optional APIs in
  the documentation.
- Use "@cond INTERNAL_HIDDEN" to hide internal API details such as padding.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-07 15:39:06 -05:00
Dmytro Firsov
d63a10da54 xenvm: drivers: serial: add interrupt-driven API for Xen PV console
This commit adds support of interrupt-driven API for UART-like Xen PV
console driver. It is implemented via Xen event channels. It allows to
send and receive data by chunks (not single symbols) and without
polling.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2021-12-07 12:15:38 -05:00
Dmytro Firsov
01a9b117fe xenvm: arm64: add Xen Enlighten and event channel support
This commit adds support of Xen Enlighten page and initial support for
Xen event channels. It is needed for future Xen PV drivers
implementation.

Now enlighten page is mapped to the prepared memory area on
PRE_KERNEL_1 stage. In case of success event channel logic gets
inited and can be used ASAP after Zephyr start. Current implementation
allows to use only pre-defined event channels (PV console/XenBus) and
works only in single CPU mode (without VCPUOP_register_vcpu_info).
Event channel allocation will be implemented in future versions.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2021-12-07 12:15:38 -05:00
Pieter De Gendt
4d161a3b23 drivers: counter: NXP SNVS rtc: Add support for NXP imx SNVS RTC
Adds a driver using the SNVS high power and optionally low power
RTC instances. A device specific function `mcux_snvs_rtc_set` is
provided to update the current counter value.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-12-07 09:45:43 -06:00
Aymeric Aillet
f2f89d1721 devicetree: fix DT_FOREACH_STATUS_OKAY brief
Remove mention to DT_DRV_COMPAT in brief since DT_FOREACH_STATUS_OKAY
is not relying on it and is taking "compat" as argument.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-12-07 09:26:45 -06:00
Flavio Ceolin
3624b51f24 pm: device_runtime: Use pm flags for runtime state
Although we are declaring `pm->enable`as bitfield, it ends up using
more memory due memory alignment.

Since we already have an atomic variable for device flags, this commit
adds a new flag to indicates whether or not device runtime is enabled.
Doing it we are saving some extra bits and avoiding need to lock the
mutex in several situations since we can atomically check if pm
runtime is enabled on a given device.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-12-06 13:41:25 -05:00
Dominik Ermel
fb2b99a06c fs: Add FS_MOUNT_FLAG_USE_DISK_ACCESS flag
The commit adds new mount flag that requests, when supported by
a file system driver, to use Disk Access API.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-12-06 08:08:26 -05:00
Michał Narajowski
4c30895a1a Bluetooth: Mesh: Refactor Health Client into async API
- Add optional callback to receive status messages even when using async
  API
- Split acked and unacked API

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-12-06 08:04:02 -05:00
Daniel Leung
d387c863bb kernel: mem_domain: remove extra slash in Z_PROGBITS_SYM
The macro Z_PROGBITS_SYM has "\%" but this is not correct
usage to escape "%". So remove the extra slash. Note that
this macro is used directly to generate assembly code
so it cannot be "%%" as in escaping "%" in printf().

Fixes #40439

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-12-05 10:22:26 -05:00
Gerard Marull-Paretas
7bfd0976aa pm: state: PM_STATE_DT_ITEMS_LEN->DT_NUM_CPU_POWER_STATES
Rename PM_STATE_DT_ITEMS_LEN to DT_NUM_CPU_POWER_STATES to make its
purpose more clear. This macro could be made part of a Devicetree API
for PM in the future.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 12:33:57 -05:00
Gerard Marull-Paretas
5ab7d35e7c pm: state: PM_STATE_DT_ITEMS_LIST->PM_STATE_LIST_FROM_DT_CPU
Rename the PM_STATE_DT_ITEMS_LIST macro to PM_STATE_LIST_FROM_DT_CPU to
make its purpose more clear. Similar naming scheme is found e.g. in the
GPIO API.

Associated internal macros and docstrings have been adjusted, too.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 12:33:57 -05:00
Gerard Marull-Paretas
fa96955305 pm: state: PM_STATE_INFO_DT_ITEMS_LIST->PM_STATE_INFO_LIST_FROM_DT_CPU
Rename the PM_STATE_INFO_DT_ITEMS_LIST macro to
PM_STATE_INFO_LIST_FROM_DT_CPU to make its purpose more clear. Similar
naming scheme is found e.g. in the GPIO API.

Associated internal macros and docstrings have been adjusted, too.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 12:33:57 -05:00
Gerard Marull-Paretas
e1ba1e5209 pm: state: fix PM_STATE(_INFO)_DT_ITEMS_LIST docs
node_id is for a CPU node, not a zephyr,power-state compatible.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 12:33:57 -05:00
Gerard Marull-Paretas
b8a6223deb pm: state: convert PM_STATE_DT_ITEM to standalone initializer
PM_STATE_DT_ITEM could not be used as a standalone initializer since it
had a trailing ',', making it an internal helper in practice.  This
change renames the macro to PM_STATE_DT_INIT, and moves the ',' to the
UTIL_LISTIFY helper.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 12:33:57 -05:00
Gerard Marull-Paretas
68372aa562 pm: state: convert PM_STATE_INFO_DT_ITEM to standalone initializer
PM_STATE_INFO_DT_ITEM could not be used as a standalone initializer
since it had a trailing ',', making it an internal helper in practice.
This change renames the macro to PM_STATE_INFO_DT_INIT, and moves the
',' to the UTIL_LISTIFY helper.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 12:33:57 -05:00
Gerard Marull-Paretas
5d5b2809b0 pm: state: improve formatting
- stick to 80 cols
- push macros '\' to 80 cols
- remove spaces from code examples
- add missing power-states node in example code

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 12:33:57 -05:00
Gerard Marull-Paretas
7a5cd51052 pm: state: simplify DT macros
Use DT_PHANDLE_BY_IDX in the intermediate UTIL_LISTIFY helper so that
initializer macros receive the node with properties of intereset.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 12:33:57 -05:00
Gerard Marull-Paretas
78dc8ce338 drivers: timer: improve sys_timer_disable usage
- Remove the weak symbol definition
- Notify about the capability of disabling via a selected Kconfig option
  (CONFIG_SYSTEM_TIMER_HAS_DISABLE_SUPPORT)
- Provide a dummy inline function when the functionality is not
  available

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 07:34:53 -05:00
Gerard Marull-Paretas
b1ced75386 drivers: timer: move initialization setup to drivers
The weak symbol sys_clock_driver_init has been removed, therefore moving
the init responsability to the drivers themselves. As a result, the init
function has now been made static on all drivers and moved to the
bottom, following the convention used in other areas.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 07:34:53 -05:00
Tom Burdick
7b1349cfe6 stats: i2c: I2C stats
Adds the ability for I2C drivers to report synchronous transfer stats
using a I2C specific macro to define the device instance.

The macro creates a container for device_state which allows for per
instance device class common data structure to be used in the device
class api (ex: i2c.h). This is used to maintain per driver instance
stats for all i2c drivers. This is a reusable idea across other device
classes as desired.

Using Kconfig device class stats may be turned on/off individually
this way as well, in this case I2C_STATS.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2021-12-04 07:22:56 -05:00
Krzysztof Chruscinski
f346af2c58 logging: Extend support for compilation with up to 31 arguments
Logging v2 supports 255 arguments but since logging v1 was supporting
only 15, and it is still compiled, more than 15 could not be used.
Extending logging v1 macro to accept up to 31 arguments. It will fail
during processing in case of v1 but will work with v2 enabled. It is
a temporary solution since v1 will be removed at some point.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-04 12:19:27 +01:00
Daniel DeGrasse
b0dfda1584 drivers: pwm_mcux: Update MCUX pwm driver to use clock bindings
MCUX PWM driver used hardcoded clock source. update driver to use clock
bindings to determine PWM peripheral clock frequency.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-03 16:44:12 -06:00