Commit graph

15409 commits

Author SHA1 Message Date
Pieter De Gendt
19c9d0894a drivers: can: transceiver: Place API into iterable section
Add wrapper DEVICE_API macro to all can_transceiver_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-02 14:24:28 +01:00
Jordan Yates
feabe003ba devicetree: add DT_ANY_INST_HAS_BOOL_STATUS_OKAY
Add `DT_ANY_INST_HAS_BOOL_STATUS_OKAY` as a complement to
`DT_ANY_INST_HAS_PROP_STATUS_OKAY`. This macro exists because boolean
properties not present on a node are still generated with a value of 0,
and therefore cannot be used with `DT_ANY_INST_HAS_PROP_STATUS_OKAY`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-12-02 11:13:52 +01:00
Dominik Ermel
55c12f2c40 storage: flash map: Add flash_area_sectors
The commit adds flash_area_sectors function that allows to get information
on sector/erase page layout by flash_area object pointer instead of
index.
The only difference between flash_area_sectors and flash_area_get_sectors
is that the later calls flash_area_open internally and as such requires
flash map to be compiled in.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-12-02 09:43:00 +01:00
Dominik Ermel
984be5eb65 storage: flash map: Add FIXED_PARTITION(label) macro
The commit adds FIXED_PARTITION(label) macro that allows to obtain
struct flash_area object for partition of given label.
The macro allows instantiation of partition at point of usage
and will be replacing need for defining flash map with all partition
entries.
Area obtained with the macro should not be passed to open, instead
flash_area_device_is_ready, basically equivalent of device_is_ready
should be called on the obtained pointer to check if area is ready
for use.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-12-02 09:43:00 +01:00
Flavio Ceolin
ee050e27a6 toolchain: Add __noinline attribute
Add a new attribute to instruct the compiler to not inline a function.

Signed-off-by: Flavio Ceolin <flavio.ceolin@gmail.com>
2024-11-30 01:04:11 +01:00
Flavio Ceolin
7e32b2069d toolchain: xcc: Avoid undefs
Re-order some definitions and header inclusion to avoid undef symbols.

Signed-off-by: Flavio Ceolin <flavio.ceolin@gmail.com>
2024-11-30 01:04:11 +01:00
Przemyslaw Bida
e0f94f8823 drivers: ieee802154: New API for modulated carrier wave transmission.
Added new API function to start modulated carrier wave transmission

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2024-11-29 21:46:46 +01:00
Francois Ramu
f670551008 include: bindings: clock stm32f4 header reformat code
Apply clang-format to re-format the stm32f4_clock header file

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-11-29 15:29:44 +01:00
Francois Ramu
a63e880010 include: clock: stm32f4 high speed clock definition
Add the HSI and HSE clock source for the stm32f4 serie

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-11-29 15:29:44 +01:00
Pieter De Gendt
8442b6a83f drivers: adc: Place API into iterable section
Move all adc driver api structs into an iterable section, this allows us
to verify if an api pointer is located in compatible linker section.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-29 14:50:40 +01:00
Chaitanya Tata
619cdb64f4 wifi: Fix current PHY rate handling
Fix the name to include TX and also add units to the shell display.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-11-29 11:45:58 +01:00
Chaitanya Tata
9762c32115 wifi: Update help/notes for forcing regulatory domain
With recent changes the regulatory domain is handled via the hostap
rather than by passing and going through the driver and hostap doesn't
have any option for forcing the regulatory domain, so, add a note to
reflect that this is implementation dependent to cover both hostap as
well other offloaded implementations.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-11-29 05:42:03 +01:00
Emil Gydesen
f254280f1f Bluetooth: Audio: Fix bad docs for codec helper functions
Several of the codec helper functions used @retval incorrectly
Several functions referenced @ccid_list incorrectly

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-28 12:53:09 +01:00
Aksel Skauge Mellbye
f3246cda17 drivers: pinctrl: silabs: Add pinctrl driver for digital bus
Silicon Labs Series 2 and newer devices do alternate function
configuration fundamentally differently from Series 0 and 1. Pin routing
is done in a centralized fashion in the GPIO peripheral, as opposed to
having ROUTE registers in every peripheral. The concept of alternate
function location numbers also does not exist, functions are directly
assigned to GPIOs by their port and pin number.

This commit adds a new pinctrl driver for devices that use DBUS. It fully
makes use of pinctrl design principles as outlined in the Zephyr
documentation. The previous driver hard-codes pin properties such as filter
and pull-up/down in the driver itself, while the new driver leaves this up
to the user as configurable DeviceTree properties. The previous driver has
hard-coded support for UART, SPI and I2C, while the new driver has generic
support for all DBUS signals.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2024-11-27 22:51:55 -05:00
Armando Visconti
a867dbdc47 sensors: lsm6dsv16x: add RTIO async and fifo stream
Add RTIO async and RTIO stream functionalities that enables,
among all the other things, the sensor data streaming from FIFO.

RTIO stream is using both SENSOR_TRIG_FIFO_WATERMARK and
SENSOR_TRIG_FIFO_FULL triggers. The decoder currently only supports
following FIFO tags:

  - LSM6DSV16X_XL_NC_TAG
  - LSM6DSV16X_GY_NC_TAG
  - LSM6DSV16X_TEMP_NC_TAG

Following FIFO parameters has to be defined in device tree to
correctly stream sensor data:

  - fifo-watermark (defaults to 32)
  - accel-fifo-batch-rate (defaults to LSM6DSV16X_DT_XL_NOT_BATCHED)
  - gyro-fifo-batch-rate (defaults to LSM6DSV16X_DT_GY_NOT_BATCHED)
  - temp-fifo-batch-rate (defaults to LSM6DSV16X_DT_TEMP_NOT_BATCHED)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2024-11-27 21:06:30 +00:00
Andy Ross
7cdf40541b kernel/sched: Eliminate PRESTART thread state
Traditionally threads have been initialized with a PRESTART flag set,
which gets cleared when the thread runs for the first time via either
its timeout or the k_thread_start() API.

But if you think about it, this is no different, semantically, than
SUSPENDED: the thread is prevented from running until the flag is
cleared.

So unify the two.  Start threads in the SUSPENDED state, point
everyone looking at the PRESTART bit to the SUSPENDED flag, and make
k_thread_start() be a synonym for k_thread_resume().

There is some mild code size savings from the eliminated duplication,
but the real win here is that we make space in the thread flags byte,
which had run out.

Signed-off-by: Andy Ross <andyross@google.com>
2024-11-27 10:38:05 -05:00
Jamel Arbi
70add85f9f drivers: openthread: nxp: Add a HDLC RCP communication
Add a HDLC RCP communication with its hdlc_api interface APIs
and a NXP driver.

Signed-off-by: Jamel Arbi <jamel.arbi@nxp.com>
2024-11-27 10:37:21 -05:00
Dominik Ermel
69b3ccf061 Revert "storage: flash map: Add FIXED_PARTITION(label) macro"
This reverts commit 1f1dc372cd.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-27 10:36:55 -05:00
Dominik Ermel
75a881313f Revert "storage: flash map: Add flash_area_sectors"
This reverts commit b50dc43a26.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-27 10:36:55 -05:00
Dominik Ermel
b50dc43a26 storage: flash map: Add flash_area_sectors
The commit adds flash_area_sectors function that allows to get information
on sector/erase page layout by flash_area object pointer instead of
index.
The only difference between flash_area_sectors and flash_area_get_sectors
is that the later calls flash_area_open internally and as such requires
flash map to be compiled in.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-27 06:58:43 -05:00
Dominik Ermel
1f1dc372cd storage: flash map: Add FIXED_PARTITION(label) macro
The commit adds FIXED_PARTITION(label) macro that allows to obtain
struct flash_area object for partition of given label.
The macro allows instantiation of partition at point of usage
and will be replacing need for defining flash map with all partition
entries.
Area obtained with the macro should not be passed to open, instead
flash_area_device_is_ready, basically equivalent of device_is_ready
should be called on the obtained pointer to check if area is ready
for use.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-27 06:58:43 -05:00
Josuah Demangeon
8c226b98ac drivers: video: controls: document each control and move classes
Make controls more readable and intuitive to extend, with definition
of each control value to help disambiguate between similar controls,
such as BRIGHTNESS vs GAIN.

Move the class definition to the top of each relevant class, like it
is on Linux for the V4L2_CID_..._CLASS_BASE variables.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2024-11-27 10:31:54 +01:00
Josuah Demangeon
217f053ccd drivers: video: controls: rename controls to Linux-like names
This uses Linux V4L2 controls as a reference to give names to the
CIDs. Apply the renaming down to the drivers that use them.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2024-11-27 10:31:54 +01:00
Josuah Demangeon
9a6df717f0 drivers: video: controls: Sort controls according to their class
Now that Control IDs have different classes, sort them to their
apropriate classes sections.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2024-11-27 10:31:54 +01:00
Josuah Demangeon
d96b3725e4 drivers: video: controls: use the same CID numbers as Linux
Refers to the CID numbers found in the Linux Kernel so that each CID
of Zephyr matches the CIDs of Linux. The new CIDs introduced in
Zephyr can then follow the same number and naming found on Linux.

No renaming of the CID macro names is done yet.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2024-11-27 10:31:54 +01:00
Josuah Demangeon
962da420cd drivers: video: controls: use the same classes IDs as Linux
The V4L2 and V4Z list of control IDs are slightly different. Use the
same CIDs as Linux, with the exact same numbers to facilitate debug
and co-development.

This also rename the GENERIC class into BASE as in Linux. No change
in the video CIDs names in this commit.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2024-11-27 10:31:54 +01:00
Olivier Lesage
b72300f7d8 bluetooth: host: document that step_data_buf can be NULL
If the controller reports 0 steps in the subevent results, the pointer
is NULL.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2024-11-27 10:31:25 +01:00
Olivier Lesage
080250716c bluetooth: host: cast LE_CS_TIME_DIFFERENCE_NOT_AVAILABLE explicitly
The special value 0x8000 is just outside the range of an int16_t,
so this should help make sure whatever overflow behavior is entered
by using the step data structs on protocol bytes is the same as this
macro.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2024-11-27 10:31:25 +01:00
Théo Battrel
66ff97e69b Bluetooth: Host: Deprecate BT_BUF_ACL_RX_COUNT symbol
Because the number of ACL RX buffers must be at least the number of
maximum connections plus one, increasing `CONFIG_BT_MAX_CONN` could
inadvertently lead to a build failure if the number of ACL RX buffers is
not also increased. This dependency may not be obvious to users.

To address this issue, this commit deprecates the
`CONFIG_BT_BUF_RX_COUNT` Kconfig symbol and computes the value in
`buf.h` using the new `BT_BUF_RX_COUNT` define. Note that the default
value and the minimum range value have been changed to 0 to "disable"
the option.

Additionally, to allow users to increase the number of ACL RX buffers,
this commit introduces the new `CONFIG_BT_BUF_RX_COUNT_EXTRA` Kconfig
symbol. The value of this symbol will be added to the computed value of
`BT_BUF_RX_COUNT`.

The configurations of tests and samples have been updated to reflect
these changes.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-11-27 10:30:59 +01:00
Jilay Pandya
719cd2639c drivers: stepper: refactor set_actual_position to set_reference_position
This commit refactos set_actual_position to set_reference_position.
stepper_set_reference_position is more apt in regards to what this func
actually does

Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
2024-11-27 10:29:47 +01:00
Mark Wang
fb811f1599 bluetooth: ssp: support pairing_accept for ssp
when receiving the io cap request from controller, call
pairing_accept to check whether application accept the
pairing. If no, reply BT_HCI_OP_IO_CAPABILITY_NEG_REPLY.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2024-11-27 10:29:36 +01:00
Aleksander Wasaznik
5a8daffc32 Bluetooth: Tester: Use BT_L2CAP_SEG_RECV for L2CAP tests
This API gives better control on L2CAP COC credits and suits better
for Upper Tester implementation.

Co-authored-by: Szymon Janc <szymon.janc@codecoup.pl>
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-11-27 08:16:18 +01:00
Pieter De Gendt
e63c6cd534 device: Add DEVICE_API macros
Add macro definitions for device drivers to instantiate API structs
into iterable sections and to evaluate them.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-27 08:15:22 +01:00
Bjarki Arge Andreasen
ece79c3767 device: Add device subsystem enumeration script
The device enumeration feature requires all devices
to place their API implementation in linker sections
by api type. This commit adds a script which uses
the tag __subsystem to identify all existing driver
API types and generate iterable sections for them.

The script is invoked from the top CMakeLists.txt

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
Co-authored-by: Pieter De Gendt <pieter.degendt@basalte.be>
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-27 08:15:22 +01:00
Dat Nguyen Duy
2b2b41d775 arch: arm: cortex_a_r: add Kconfig options for cache segregation
On Arm Cortex R52, cache segregation policy controls the
number of L1 I/D cache ways that are allocated to Flash
and AXIM interface. Adding Kconfig options for configuring
it.

Writing to IMP_CSCTRL is only permitted before the caches
have been enabled, following a system reset.

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2024-11-26 15:43:45 -05:00
Jukka Rissanen
34ed76b185 net: prometheus: Add way to format output by a metric
Instead of requiring one big buffer for formatting the output,
have a walk function that can be used to generate output by
one metric at a time.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
7e881d22a1 net: stats: Add prometheus support
Allow user to update prometheus metrics from network statistics.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
f0736e0b68 net: http: service: Allow user to set service as static
Remove the "static" from HTTP service definition macro so that
user is able to add it or leave it out if needed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
c7989b5747 net: prometheus: Add more parameters to metric macros
Add collector parameter to metric creation macros so that it
is possible to bind the metric to collector already at built
time.

Also add optional user_data to metric macro calls so that user
can add optional data there. This will be used by network statistics
Prometheus support in subsequent commits.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
fdae68ac5d net: prometheus: Network statistics need pointer to collector
When creating prometheus network statistics variables, we need
to map the variables back to the collector, so add a backpointer
to it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
8e83cf0797 net: prometheus: Configure max number of labels from Kconfig
Allow user to configure the label count from Kconfig.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
d3efcbd316 net: prometheus: Remove need to have separate metric struct
Embed "struct prometheus_metric" to individual metric like
counter, gauge, histogram and summary. This way we avoid having
a separate base pointer in specific metrict struct. We also do
not need to search the specific metric from base metric as
we can simply use CONTAINER_OF() macro to get the base metric.

This embedding means that the counter, gauge, histogram and summary
metric define macros are changed as user does not need to create a
separate "struct prometheus_metric".

Convert the tests and sample to use the new macros.

Remove also the static from metric creation macros so that user
can decide whether it needs collector to be static or not.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
5282ccaa7c net: prometheus: Use const pointer for string data
Instead of allocating space for description and label name + value,
have a const pointer for it. The data is set typically statically
when the metric is defined, so there should be no need to allocate
separate buffer for those strings.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
90fb4b38ca net: prometheus: Use linked list for metrics
Save same memory and store metrics into a linked list inside
a collector entry.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
460e2f86d7 net: prometheus: summary: Add set function to summary metric
Add prometheus_summary_observe_set() function to summary metric.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
0ec8385bec net: prometheus: counter: Add function to set the counter value
This is similar function as add, but will add the difference of
previous value and the new one. This can be used if we want to
periodically update the value with a new one but don't want to
keep track of the old one.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
d94bcd2566 net: prometheus: counter: Add function to add a value
Add function to increase the counter value with arbitrary value.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Daniel Leung
b7b4de8afe uart: refactor internal bits from public API header file
This refactors internal bits out of the public API header file
and into its own file. This includes:

* Driver API struct which is only used by driver implementations
  but not by users of API.
* Inline implementations of various APIs.
* Inline z_impl_*.

These are implementation details that do not need to live within
the public API header file. This de-clutters the public header
file.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-11-26 14:47:01 +00:00
c1c0413eed drivers: add the ch32v00x clock controller
This commit adds the clock driver for WCH CH32V003.

Signed-off-by: Michael Hope <michaelh@juju.nz>
Signed-off-by: Dhiru Kholia <dhiru.kholia@gmail.com>
2024-11-26 14:41:46 +00:00
6d3348bd83 drivers: add ch32v00x pinctrl support
This commit adds the pinctrl driver for WCH CH32V003.

Signed-off-by: Michael Hope <michaelh@juju.nz>
Signed-off-by: Dhiru Kholia <dhiru.kholia@gmail.com>
2024-11-26 14:41:46 +00:00