Commit Graph

72096 Commits

Author SHA1 Message Date
Gerard Marull-Paretas d5734bc003 drivers: sensor: ina23x: specify current LSB in uA and fix units
Specify the units of the current LSB in microamperes, so that we can
measure low maximum currents. Right now it was specified in
milliamperes, but ignored and always hardcoded to 1mA in the driver.
This makes the driver pretty much useless when the maximum current to be
measured is in a range of e.g. 20-50mA.

This patch also removes some unnecessary ifdeffery: since we write the
calibration register, we can always provice measurements with the right
units. It is also wrong to provide sensor readings that do not match
with the units specified by the channel. After this change voltage is
always reported in V, current in A and power in W.

Note that power measurement had the current LSB hardcoded in the
calculation (assuming 1mA/LSB), this has been fixed as well.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-15 10:23:17 +01:00
Gerard Marull-Paretas d7e1e44320 drivers: sensor: ina23x: improve voltage reading code
Adjusted LSB factor to be un uV/LSB to make calculations more clear.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-15 10:23:17 +01:00
Gerard Marull-Paretas a79f5b87c0 drivers: sensor: ina23x: s/rshunt/rshunt-milliohms
Following dtschema practices, add phyisical units to the shunt resistor
value: milliohms.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-15 10:23:17 +01:00
Gerard Marull-Paretas af03ad33e1 drivers: sensor: ina23x: remove redundant build asserts
With the recent introduction of DT_HAS* Kconfig helpers, such build
asserts are highly unlikely, so just remove them.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-15 10:23:17 +01:00
Gerard Marull-Paretas a34158f386 drivers: sensor: ina23x: delete redundant Doxygen docs
Driver had Doxygen stubs for sensor interface calls. First, most were
incomplete, outdated or just wrong. Second, implementations just need to
make sure to adhere to the error codes documented in the public
interface (sensor API in this case).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-15 10:23:17 +01:00
Gerard Marull-Paretas 35eabfcdf0 drivers: ina23x: fix includes
- Add many missing includes so that headers are self-contained
- Sort includes properly (locals first, stdc, zephyr, etc.)

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-15 10:23:17 +01:00
Rodrigo Peixoto 27ec69eca1 samples: zbus: Add benchmark sample
The sample measures the time to transfer 256KB from the
producer to the consumers.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2022-11-14 17:25:29 -05:00
Rodrigo Peixoto 078d561bf6 samples: zbus: Add runtime observer registration sample
The sample illustrates a way of using the runtime observer registration
feature. With this sample the developer can understand how to use static
and runtime observer registration.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2022-11-14 17:25:29 -05:00
Rodrigo Peixoto 86513fb7af samples: zbus: Add the remote mock sample
The sample illustrates a way of exchange message with a host mock
running in a Python script. It can be used to improve the testability
and controllability of the tests.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2022-11-14 17:25:29 -05:00
Rodrigo Peixoto 0528a43345 samples: zbus: Add the UART bridge sample
The sample illustrates a way of send all the channel event to the host
by using the UART, a user_data portion, and the claim/finish APIs.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2022-11-14 17:25:29 -05:00
Rodrigo Peixoto bc6963fd5b samples: zbus: Add dynamic channels sample
The sample illustrates a way of using dynamically allocated messages in
static channels.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2022-11-14 17:25:29 -05:00
Rodrigo Peixoto 5ed4781c54 samples: zbus: Add work queue sample
The work_queue sample illustrates three reaction styles available for
using zbus. The first is a listener that reacts by callback; use it should
for urgent reaction. The second is a listener that responds by callback;
instead of executing the code, it pushes a job to a work queue that will
be executed shortly but not immediately. The last one is the subscriber
that reacts using a queue; use it for an asynchronous reaction where the
developer would like to control the flow.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2022-11-14 17:25:29 -05:00
Rodrigo Peixoto 68b5b05165 samples: zbus: Add the hello world sample to zbus
The hello world sample illustrates a simple way of using zbus. There is
a listener and a subscriber interacting each other by using a read-only
and a regular channel. The APIs are called by using the function
and macro variation.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2022-11-14 17:25:29 -05:00
Rodrigo Peixoto f8f7523422 tests: zbus: Add zbus runtime observer registration tests
Add zbus subsystem test to verify the channel's runtime observers list
usage. It demonstrates the use of dynamically add and remove observer to
and from channels at runtime.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2022-11-14 17:25:29 -05:00
Rodrigo Peixoto 02b32d8703 tests: zbus: Add zbus dynamic channels tests
Add zbus subsystem test to verify the dynamic channel usage.
It demonstrates the use of static and dynamic external messages.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2022-11-14 17:25:29 -05:00
Rodrigo Peixoto 74797dd736 tests: zbus: Add zbus user_data usage tests
Add zbus subsystem test to verify the user_data usage does not affect
the normal behavior.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2022-11-14 17:25:29 -05:00
Rodrigo Peixoto 26f7d69d9e tests: zbus: Add zbus integration tests
Add zbus subsystem test to verify threads integration based on usual
interaction, masking observers, and delayed interaction to verify semaphore
and queue event dispatcher timeout.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2022-11-14 17:25:29 -05:00
Rodrigo Peixoto ccae33461a tests: zbus: Add zbus unittests
Add zbus subsystem test to verify read-only and hard channels.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2022-11-14 17:25:29 -05:00
Rodrigo Peixoto b8ecbfaa57 zbus: Add message bus subsystem to Zephyr
Add zbus message bus as a Zephyr subsystem. No message bus
or communication abstraction other than the usual (message queues,
mailboxes, etc.) enabled developers to implement event-driven systems in
Zephyr quickly. Zbus would fill that gap by providing the community with
a lightweight and flexible message bus. The implementation tries to be
closest as possible to the existing ones. We use the claim/finish
approach, and the API for publishing and reading channels are similar
in message queues. Zbus is about channels, messages, and observers.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2022-11-14 17:25:29 -05:00
Chris Friedt 47d09c04af tests: posix: mutex: test to ensure there is no resource leakage
Add a test to ensure that `pthread_mutex_t` can be used over
and over again and that there is no resource leakage with proper
usage.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2022-11-15 05:56:31 +09:00
Chris Friedt b0b4c9c3f1 posix: mutex: abstract pthread_mutex_t as uint32_t
Consistent with the change of `pthread_t` from
`struct posix_thread` to `uint32_t`, we can now also abstract
`pthread_mutex_t` as `uint32_t` and separate `struct posix_mutex`
as an implementation detail, hidden from POSIX API consumers.

This change deprecates `PTHREAD_MUTEX_DEFINE()` in favour of the
(standardized) `PTHREAD_MUTEX_INITIALIZER`.

This change introduces `CONFIG_MAX_PTHREAD_MUTEX_COUNT`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2022-11-15 05:56:31 +09:00
Chris Friedt 6042acc1a9 posix: pthread: take care with pthread mutex resources
Previously, `pthread_mutex_init()` could not actually fail, and
destroying mutexes was a no-op, so it was missing in a couple of
places.

However, with the change of `pthread_mutex_t` to `uint32_t`, and
since those are embedded inside of `struct posix_thread` for the
time being, the pthread code needs to keep track that it is
relinquishes used mutex resources when a thread completes.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2022-11-15 05:56:31 +09:00
Marcin Szkudlinski 6f3e0babb3 intel_adsp: include toolchain.h in adsp_memory.h
\MTL SOF is not compiling when
8d0eb6ce10
(devicetree: remove deprecated DT_CHOSEN_*_LABEL macros)
is applied
Fix - zephyr/toolchain used to be included by
devicetree/zephyr.h. The file has been removed by 8d0eb6ce10
Include is needed for ALWAYS_INLINE macro

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2022-11-14 14:27:01 -05:00
Anas Nashif 1eb50d5ea3 ci: twister: fix typo
Fix typo in conditional allowing upload of test results on scheduled
events.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-14 18:08:15 +01:00
Gerard Marull-Paretas a236138baa doc: release-notes: inform about regulator APIs relocation
consumer.h APIs are now part of regulator.h.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-14 16:59:05 +01:00
Gerard Marull-Paretas f7cb0933fc drivers: regulator: s/uV/uv and s/uA/ua
Zephyr coding style uses all-lowercase.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-14 16:59:05 +01:00
Gerard Marull-Paretas 6d744d3dd2 drivers: regulator: use int32_t for voltages/currents
Right now we had a mix of int (signed) and uint32_t (fixed-width
unsigned integer). Use int32_t for all cases, both values may be either
positive/negative, and we have a defined range when using fixed-width
integers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-14 16:59:05 +01:00
Gerard Marull-Paretas 561eb2b5b5 drivers: regulator: s/pmic/pca9420
The "pmic" driver was in reality a driver for NXP PCA9420 PMIC. There's
no "universal PMIC". While the driver may work for other NXP PMICs, it
is clearly not generic for other vendors PMIC.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-14 16:59:05 +01:00
Gerard Marull-Paretas 6dd395ddeb drivers: regulator: shell: drop PMIC conditional options
The regulator API supports all voltage/current ops, so there's no need
to guard them under "PMIC". If a particular driver doesn't support the
operations it will just return -ENOSYS and the command will fail.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-14 16:59:05 +01:00
Gerard Marull-Paretas 0a390b3ed6 drivers: regulator: improve Doxygen
The recently moved "consumer" API had multiple Doxygen issues. This
patch improves the Doxygen docs, e.g. use `@retval`, remove redundant
docs, improve parameter docs, etc.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-14 16:59:05 +01:00
Gerard Marull-Paretas ec3c566f8c drivers: regulator: convert all API calls to use ops
The previous "consumer" API was designed without API ops, meaning only a
single implementation (singleton) was possible. This was inconsistent
with all other APIs, and, a problem in systems where more than a single
PMIC IC is present.

Note that all "consumer" ops are optional, so this won't break any
existing drivers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-14 16:59:05 +01:00
Gerard Marull-Paretas 74e40f88ae drivers: regulator: move consumer.h to regulator.h
In Zephyr all regulator APIs are consumer APIs. There's no point in
adding a separate header file. Our current implementation is also
inconsistent with Linux, where enable/disable are also part of the
consumer.h API.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-14 16:59:05 +01:00
Erwan Gouriou 179a57a956 MAINTAINERS.yaml: Add Guillaume Gautier as STM32 collaborator
Add gautierg-st as STM32 collaborator.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-11-15 00:56:43 +09:00
Chris Friedt 39d08a80d4 MAINTAINERS: additional collaborators for FPGA drivers
Adding Tomasz, Filip, and Mateusz as collaborators.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2022-11-15 00:55:47 +09:00
Tomasz Moń c011646081 drivers: flashdisk: check partition constraints
Fail with error if any of flashdisk partition assumptions are not met:
  * uniform page size through the whole partition
  * flashdisk starts at page boundary
  * flashdisk ends at page boundary

Read-only flashdisks are not subject to above conditions because the
cache buffer is not used for read-only flashdisks.

The checks can be disabled via Kconfig option to save code space.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-11-14 16:37:04 +01:00
Tomasz Moń 8981015335 drivers: flashdisk: support read-only flashdisks
Force cache-size to 0 and treat flashdisk as read-only when backing
partition has read-only flag set. This allows users to save RAM when the
application does not write to the flashdisk, e.g. when a predefined FAT
filesystem is used.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-11-14 16:37:04 +01:00
Troels Nilsson fc8651746b bluetooth: Fix occasional BSim mesh test failure
Two tests were using the same simulation id, causing occasional failures
when all tests were run in parallel

Signed-off-by: Troels Nilsson <trnn@demant.com>
2022-11-14 16:31:10 +01:00
Robert Lubos 250116cd44 tests: net: ipv6_fragment: Improve test_recv_ipv6_fragment test case
Fix some problems with test_recv_ipv6_fragment test case:
* net_pkt_ipv6_hdr_prev was not set, in result reassembly logic
  overwritten wrong part of the IPv6 header
* Wrong checksum was set in the first fragment

Add more verification to the test_recv_ipv6_fragment test case:
* Actually register ICMPv6 Echo Reply handler so that the reassembled
  packet can be analyzed
* Verify that IPv6, ICMPv6 headers and data are correct

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-11-14 16:26:20 +01:00
Robert Lubos f0619254ca tests: net: ipv6_fragment: Add test to verify fragmentation loopback
Add test case which verifies that IPv6 fragmentation and reassembly
works correctly in loopback scenario. The test case verfies that:

* IPv6 packet is fragmented correctly in the send handler
* IPv6 packet is reassembled correctly in UDP receive handler.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-11-14 16:26:20 +01:00
Robert Lubos f7eff96c88 tests: net: ipv6_fragment: Fix wait_data semaphore usage
The test cases which make use of wait_data semaphore incorrectly fed the
semaphore after processing the first fragment, instead of waiting for
all of the expected fragments to be processed. Adittionally, the test
cases did not really fail if the semaphore timeout occured (hence if for
example last fragment was lost, it wouldn't be detected by the test).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-11-14 16:26:20 +01:00
Robert Lubos c8fa200329 tests: net: ipv6_fragment: Remove unused interface
The second interface was not really used by the testsuite and only
obfuscated the testsuite content, hence remove it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-11-14 16:26:20 +01:00
Chris Friedt f15abd54cc MAINTAINERS: Add cfriedt as maintainer for FPGA drivers
Add myself as maintainer for FPGA drivers.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2022-11-14 09:44:48 -05:00
Anas Nashif 67e8d03280 tests/samples: fix some missing tags
Many driver samples or tests only had 'drivers' as the tag, without a
tag indicating what driver that is exactly, so add some missing tags.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-14 07:08:04 -05:00
Martin Tverdal 09b514a610 Bluetooth: Fix issue with adv_stop
If adv stop was called form connected callback,
it would continue and unref the wrong conn object
if there where 2 connectable advertisers running,
but with only one 1 id configured.

Fixes #52196

Signed-off-by: Martin Tverdal <martin.tverdal@nordicsemi.no>
2022-11-14 13:07:51 +01:00
Vinayak Kariappa Chettimada b56a6906e2 Bluetooth: Controller: Fix advertising disable on connection complete
Fix advertising set's is_enabled flag to be reset when
connection complete is dequeued for connectable advertising
started using legacy advertising enable HCI commands. And
reset the is_enabled flag when advertising set terminated
is dequeued for connectable advertising enabled using
Extended Advertising HCI commands.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-11-14 13:06:38 +01:00
Vinayak Kariappa Chettimada 13c29940bf Bluetooth: Controller: Fix ticker ticks diff calculation
Fix ticks difference calculation to determine delayed
prepare callback. Without the use of masking by
ticker_ticks_diff_get, the diff value can be higher than
the supported 24-bit value. i.e. ticker_ticks_now_get()
rolls over in 24-bit value, whereas ticks_at_event is
free running value of 32-bits.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-11-14 13:06:21 +01:00
Yonatan Schachter b49b11555c samples: flash_shell: Fix flash range printing
When running a flash read command on the flash shell, the hexdump
prints came out incorrect. There was a space missing between the
ninth element and its preceding "|", and a redundant newline.
This commit fixes this issue.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2022-11-14 12:38:03 +01:00
Yonatan Schachter c5cb0d1a3b samples: blinky_pwm: Fix sample for rpi_pico
The RP2040 needs a DTS overlay for the PWM to work with the
blinky_pwm examples. This commit adds the required overlay.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2022-11-14 12:37:47 +01:00
Benjamin Lindqvist 85c6de4335 lorawan: enable run-time config of region/freq
This commit adds support for compiling in support for several different
regions/frequencies and dynamically choosing which to use in run-time.
This commit introduces no API breakages - if a prj.conf contains only a
single region Kconfig, the new function lorawan_set_region() does not
need to be called.

Signed-off-by: Benjamin Lindqvist <benjamin@eub.se>
2022-11-14 11:16:16 +00:00
Daniel DeGrasse c303c6fae7 scripts: pylib: remove west log dependency from domains.py
Convert domains.py to use basic python logging module implementation to
remove west logging dependency. This removes hard dependency on west from
twister.

Fixes #51731

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-11-14 10:12:31 +00:00