Commit graph

15409 commits

Author SHA1 Message Date
Krzysztof Chruscinski
747d6ffdb0 shell: Remove support for logging v1
Remove support for logging v1 from shell log backend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-15 10:55:26 -04:00
Abramo Bagnara
ada9ca4c93 coding guidelines: comply with MISRA C:2012 Rule 7.2
MISRA C:2012 Rule 7.2 (A `u' or `U' suffix shall be applied to all
integer constants that are represented in an unsigned type)

Added missing `U' suffixes in constants that are involved in the
analyzed build, plus a few more not to introduce inconsistencies
with respect to nearby constants that are either unused in the
build (but implicitly unsigned) or are used and are immediately
converted to unsigned.

Signed-off-by: Abramo Bagnara <abramo.bagnara@bugseng.com>
2022-06-14 13:36:14 -04:00
Kumar Gala
f73a389e47 net: if: make driver name consistent for DT macros
Fixup how the drv_name field is set in NET_DEVICE_DT_OFFLOAD_DEFINE
and NET_DEVICE_DT_DEFINE_INSTANCE to be consistent with
NET_DEVICE_DT_DEFINE.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-14 09:31:39 +02:00
Luca Fancellu
58efbc6f4f drivers: xen: keep track of missed events on event channels
The current implementation for events channel is using an empty
callback for every unbind channel and the interrupt is clearing
every event and calling the callback.
However in a scenario where a domain fires a notification when
another has not yet bind the channel, the event will be missed.

To address this limitation, this commit is keeping track of
missed event channel notification when the empty callback is
used, a function to retrieve and clear the missed event is
introduced.

Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
2022-06-14 09:31:03 +02:00
Jedrzej Ciupis
644da741f4 net: pkt: add IEEE 802.15.4 TX power field
This commit extends the `struct net_pkt` structure with
`ieee802154_txpwr` field that contains signed value of the desired
transmission power of a IEEE 802.15.4 frame in dBm.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2022-06-14 09:30:43 +02:00
Gerard Marull-Paretas
a44664e95b device: remove deprecated (z_)device_usable_check
The API was deprecated in favor of (z_)device_is_ready.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-14 09:30:22 +02:00
Gerard Marull-Paretas
659f23c01f device: remove deprecated SYS_DEVICE_DEFINE
The macro was deprecated in favor of SYS_INIT.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-14 09:30:22 +02:00
Daniel Leung
33f8d0df4e kernel: workq: add k_work_user_queue_thread_get()
This adds a simple function to get the thread pointer to the user
mode thread of the user work queue. This is useful for granting
that user mode thread additional access to kernel objects.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-06-13 16:19:34 -04:00
Dominik Ermel
194340b1a2 storage/flash_map: Fix typos in flash_area_open documentation
Fixed typos.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-06-13 11:28:18 -05:00
Martí Bolívar
d130160813 devicetree.h: clean up token API docstrings
Clean up the docstrings for the APIs related to converting property
values to tokens. I think the current language has a few issues and
could be made clearer in some cases.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-06-13 09:44:32 -04:00
Kumar Gala
bd2b7e9502 net: if: Fix NET_DEVICE_DT_DEFINE_INSTANCE macro
Fix NET_DEVICE_DT_DEFINE_INSTANCE to pass through the init_fn
argument to Z_NET_DEVICE_INIT_INSTANCE.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-13 12:12:35 +02:00
Mariusz Skamra
fd3d5ac75c Bluetooth: audio: Minor documentation fix
Fix bt_audio_capability_set_available_contexts documentation.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-06-13 12:12:11 +02:00
Mariusz Skamra
e5cfb1ca4a Bluetooth: audio: Add getter for available audio context
Extend API with available audio contexts getter method.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-06-13 12:12:11 +02:00
Krzysztof Chruscinski
4c9633c2aa toolchain: common: Extending macro set for memory sections
Added macro for getting nth element from section.
Added macro for counting elements in the section.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-13 12:12:02 +02:00
Chay Guo
b47a8a428f drivers: clock_control: mcux_lpc_syscon_clock: Add flexcomm16 suppport
Added FlexCOMM16(HS SPI1) clock for MIMXRT5xx.

Signed-off-by: Chay Guo <changyi.guo@nxp.com>
2022-06-13 12:10:57 +02:00
Lars Knudsen
c27532eec4 Bluetooth: csis: add RSI advertising callback
Makes it possible for an application to
handle CSIS RSI advertising by registering a
callback, which will disable the internal
CSIS advertising.

Also fixes registering callbacks in CSIS.

Signed-off-by: Lars Knudsen <larsgk@gmail.com>
2022-06-10 09:47:40 +02:00
Georgij Cernysiov
a8fbdf72f7 lib: os: cbprintf: fix cbprintf_enums include path
Corrects `cbprintf_enums.h` include path to contain
<zephyr/...> prefix.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-06-09 18:28:47 +02:00
Andrei Emeltchenko
770f57e163 toolchain: Add __maybe_unused attribute
Add attribute __maybe_unused similar to Linux kernel.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-06-09 11:34:25 +02:00
David Palchak
b4a7f0f2ca linker: ensure global constructors only run once
Rename the symbols used to denote the locations of the global
constructor lists and modify the Zephyr start-up code accordingly.
On POSIX systems this ensures that the native libc init code won't
find any constructors to run before Zephyr loads.

Fixes #39347, #36858

Signed-off-by: David Palchak <palchak@google.com>
2022-06-09 11:33:36 +02:00
Chay Guo
08641f0616 driver: sensor: mcux_acmp: add discrete mode
The ACMP on i.MXRT11xx support discrete mode,
updated the driver to support discrete mode configuration.

Signed-off-by: Chay Guo <changyi.guo@nxp.com>
2022-06-09 11:30:49 +02:00
Seppo Takalo
e0296ca0b9 net: lwm2m: Allow initializing opaque and string data to zero length
By default, any string or opaque data that LwM2M engine initializes
sets data lenght to same value as given buffer length for that
resource.

However, on run time, engine keeps track how much data is written
to each resource, so when reading from any resource, should only
return data that has been written there. But uninitialized resources
return the content of the whole buffer.

Fixed the problem by introducing macros INIT_OBJ_RES_LEN(),
INIT_OBJ_RES_MULTI_DATA_LEN() and INIT_OBJ_RES_DATA_LEN() that
allows you to give the amount of data existing in buffer when
the resource is initialized. This sets the data_len and max_data_len
variables correctly.

Also introduced new functions lwm2m_engine_get_res_buf() and
lwm2m_engine_set_res_buf() that distinct between data size and
buffer size. Deprecated the previous functions
lwm2m_engine_get_res_data() and lwm2m_engine_set_res_data()

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2022-06-09 11:30:37 +02:00
Krzysztof Chruscinski
d660492914 logging: Add option for prolonged backend initialization
Extended logging backend API with log_backend_is_ready call which
returns 0 is backend is ready. Logging core will make sure that
all autostarted backends are ready before they are enabled.

This option allows to handle backends which are not yet ready
after init function is called (e.g. usb backend that is not plugged
in). If this is the only backend in the system, logging processing
will not start util first backend is ready.

Function for checking readiness is optional and when backend has
no such function it is assumed that backend is ready after
initialization function returns which makes this feature backward
compatible.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-09 09:40:01 +02:00
Mariusz Skamra
031717a916 Bluetooth: lc3: Improve BT_CODEC_LC3_CHAN_COUNT_SUPPORT macro
This improves the macro so that it can take variable number of
arguments, e.g. BT_CODEC_LC3_CHAN_COUNT_SUPPORT(1, 2, 8).

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-06-08 12:45:34 +02:00
Jordan Yates
319ffaed0a pm: device: helper to query power state
Adds a helper function to query whether a device is currently powered.
This can be used to determine if the chip can be initialised now, or if
it needs to be deferred.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-06-08 12:43:00 +02:00
Carlo Caione
673f41e708 riscv: Introduce support for RV32E
Introduce support for RV32E.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-06-08 18:50:22 +09:00
Carlo Caione
737dccec1a riscv: Move syscall parameter from a7 to t0
To prepare for RV32E support.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-06-08 18:50:22 +09:00
Andy Ross
8246d88bd3 include/arch_interface.h: Clarify platform-dependencies
Clarify a few restrictions that seem obvious but weren't specified:

+ On MP systems, counters are often asynchronous between cores, so you
  need to make sure all the values read are on the same CPU.

+ Many platforms have a 32 bit (or smaller, c.f. Cortex M SysTick)
  internal counter, but are being forced to return a 64 bit quantity
  that will behave badly on rollover (you can't just subtract two
  times anymore!).  Demand that the existing arch_timing_cycles_get()
  API (which didn't seem to have useful much to do) implement rollover
  correction on the subtraction.

This allows an Xtensa implementation based on direct CCOUNT reads on
intel_adsp to be correct per the API docs.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-06-07 19:04:42 +02:00
Krzysztof Chruscinski
0829610bbc lib: os: spsc_pbuf: Add option to use cache
Add flags option to init call and a flag to use cache.
Add Kconfig choice to pick how to approach cache. Cache can be
enforced in all spsc_pbuf instances, disable in all, or runtime selected
based on configuration flag. Option is added to allow memory footprint
savings.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-07 19:04:35 +02:00
Krzysztof Chruscinski
2f189e39a5 lib: os: Rename icmsg_buf to spsc_pbuf
Move icmsg_buf to lib/os and rename to spsc_pbuf (Single Producer
Single Consumer Packet Buffer). It is a generic module and initially
was created as internal module for ipc service.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-07 19:04:35 +02:00
Mariusz Skamra
4e15cbe456 Bluetooth: has: Handle active preset selection
This adds handling of active preset selection in HAS.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-06-07 18:55:04 +02:00
Emil Gydesen
c513fd87e1 Bluetooth: ISO: Rename sn to seq_num
Rename the `sn` field(s) to `seq_num` to be more readable
and clear what the value covers.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-06-07 18:53:44 +02:00
Emil Gydesen
65b5db6e3a Bluetooth: ISO: Rename ISO_INTERVAL_MIN/MAX
Rename the BT_ISO_INTERVAL_MIN/MAX to
BT_ISO_SDU_INTERVAL_MIN/MAX to avoid confusing this
the the ISO interval which is different from the SDU
interval.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-06-07 18:53:44 +02:00
Emil Gydesen
6786bbdb32 Bluetooth: ISO: Add sn and ts to bt_iso_chan_send
Add two new parameters to bt_iso_chan_send:
sn: The packet sequence number which shall be incremeted
per SDU interval.
ts: An optional timestamp value used to synchronize SDUs.

The sequence number in the API uses a 32-bit value even though
the sequence number for the HCI command is 16-bit. This is to
properly handle wrapping of sequence numbers, which is much
easier to do with additional bits allocated.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-06-07 18:53:44 +02:00
Carlo Caione
86bb739b7b reserved_memory: Remove it and cleanup
The reserved memory mechanism (sections and regions definition) has been
entirely replaced, greatly extended and made it better by the work done
on the zephyr,memory-region compatible.

Since there is are no actual users, we can remove it.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-06-07 09:41:57 -07:00
Gerard Marull-Paretas
d11c0a1ec7 drivers: adc: clarify differential sampling resolution
When using differential sampling, resolution needs to be one less, not
"may be".

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-08 01:17:31 +09:00
Gerard Marull-Paretas
73295a03e7 drivers: adc: add dt-spec helper functions
This patch adds the following dt-spec helpers:

- adc_channel_setup_dt()
- adc_raw_to_millivolts_dt()
- adc_sequence_init_dt()

The objective of these functions is to reduce application boilerplate
when Devicetree is used to configure the ADC.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-08 01:17:31 +09:00
Daniel Leung
125b33c185 logging: remove CONFIG_LOG2_MSG_PKG_ALWAYS_ADD_RO_STRING_IDXS
CONFIG_LOG2_MSG_PKG_ALWAYS_ADD_RO_STRING_IDXS was added as
a stop-gap measure to support Sys-T catalog messages. Since
the Sys-T backend has envolved to use tagged argument, this
kconfig and its effect are no longer needed. So remove it.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-06-08 00:15:55 +09:00
Daniel Leung
fe0aa4c167 logging: support tagged argument in log message packaging
This adds support for packaging with tagged arguments for log
messages so that backends can make use of this information
when they process messages.

Note that currently tagged arguments must be used with
CONFIG_LOG2_ALWAYS_RUNTIME where log messages are created via
z_log_msg2_runtime_{v,}create(). For some reason, using C++ on
Cortex-M (mps2_an385) results in an additional empty string
argument being added to the list. This does not happen if only
doing C on mps2_an385, or on other architectures.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-06-08 00:15:55 +09:00
Daniel Leung
aff6e8b2f7 lib: os: cbprint: enable tagged arguments for packaging
This adds some bits to support tagged arguments to be used for
packaging. If enabled, the packaging function no longer looks at
the format strings to determine the types of arguments, but
instead, each argument is tagged with a type by preceding it
with another argument as type (integer). This allows the format
strings to be removed from the final binary to conserve space.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-06-08 00:15:55 +09:00
Juha Heiskanen
ec1c85b385 lib: os: Extend Json library API and type update
New Types:
* Added support for Generic Numeric type (float, 64-bit)
* Added support for Opaque string type.
* Added support parse Array data in object for seprate array parsing
New API for Json Array parsing Object 1 by 1:
* json_arr_separate_object_parse_init() init array parse
* json_arr_separate_parse_object() Parsing 1 Json Object
Rename token and lexer structures and publish those.

Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
2022-06-06 12:06:43 +02:00
Reto Schneider
c6bd840a88 fcb: Fix parameter description
Function writes to, not reads from flash.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2022-06-05 14:49:06 +02:00
Ryan Erickson
d4a16768bf modem: hl7800: Enable multi-user callbacks
Change callback registration so it can support multiple users.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-06-05 14:48:47 +02:00
Gerard Marull-Paretas
fedd5584bf arch: arm64: arm_mmu: make header self-contained
The header needs definitions for integer types and size_t, however, it
did not include the necessary headers. Note that this is only required
when not working with assembler.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-05 14:48:40 +02:00
Carlo Caione
01305942f6 ipc: static_vrings: Support DT-defined buffer size
Recently OpenAMP introduced the possibility to set the sizes for TX and
RX buffers per created instance. Expose this also to Zephyr users by
using a DT property "zephyr,buffer-size".

For the sake of simplicity use the same DT property to set the buffer
size for both TX and RX buffers.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-06-05 14:46:18 +02:00
Georgij Cernysiov
70003e8eb0 dts: bindings: mpu: add PPB and IO regions
Extends #43119 with PPB and IO values of
`memory-region-mpu`.

That allows MPU region definition with
PPB or IO attributes in the DTS.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-06-05 14:46:11 +02:00
Gerard Marull-Paretas
3a2921dab0 device: make all struct device members mutable
All `struct device` members except name, config and api are marked as
read-only references. This means that, in practice, a `struct device`
can only be initialized statically.

Device constness happens because `Z_DEVICE_DEFINE` defines `struct
device` as `const`. This means that one can't modify any field of a
`struct device` anyway, so constifying struct members doesn't add much
value, if any (unless I'm missing something).

This patch makes all `struct device` references mutable, so that no
assumptions on how `struct device` is used are made. In the future, one
could e.g. dynamically allocate devices and assign any of the device
fields at runtime.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-05 14:45:51 +02:00
Mariusz Skamra
33991f2dde Bluetooth: audio: Expose API methods to change the available contexts
This exposes API methods to change the available context types.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-06-05 14:44:21 +02:00
Mariusz Skamra
20f47505d0 Bluetooth: audio: Remove unused bt_audio_capability struct member
This removes unused context member from bt_audio_capability.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-06-05 14:44:21 +02:00
Mariusz Skamra
eddfc89ebf Bluetooth: uuid: Rename PACS Available Contexts UUID define
This renames the UUID to follow the same naming scheme as for
BT_UUID_PACS_SUPPORTED_CONTEXT.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-06-05 14:44:21 +02:00
Damian Krolik
74e4ac0883 nvs: implement NVS cache
The NVS data lookup time grows linearly with the number of
allocation table entries to walk through, meaning that if
some data pair in the NVS changes frequently, access to
other data pairs that change rarely can take a lot of time.

It is particularly visible when the NVS is used as the
settings backend since the backend needs to perform multiple
NVS reads to find a requested key.

Implement a simple cache that stores an address of the most
recent ATE for all NVS IDs that fall into the given cache
position. CRC8/16 is used as a hash function used to
distribute NVS IDs across the cache entries.

The cache entries are only invalidated when an NVS sector
is erased as part of the garbage collector task.

Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
2022-06-05 14:43:59 +02:00