Previous timeouts values were done when local TCP replies wourd occur
within sender's thread. This was a known behavior: no context switch,
shorter timings for sending packets (locally only) thus shorter
timeouts.
Such behavior changed when local replies had to go through TCP's work
queue. See commit 798588e709Fixes#40129
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
In some cases, it is quite useful to have the possibility to also
include zero-length buffers in a buffer set used in transfers
(for example, when frames in a protocol consist of several parts,
of which some are optional). So far, the behavior of spi_context
update functions was that the transfer in a given direction was
finished when a zero-length buffer was encountered in the buffer
set. Change those functions to simply skip such buffers. Correct
in the same way also the spi_context_buffers_setup() function.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Do not use any timeout in the slave mode, as in this case it is not
known when the transfer will actually start and what the frequency
will be.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
The fs_open copies open flags into fs_file_t structure for use with
other VFS API calls; the commit moves the operation into success path.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Provide some factorization in pm_power_state_set procedure
to prepare shutdown case introduction.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Remove the DT_CHOSEN_ZEPHYR_CANBUS_LABEL macro and replace it with
DEVICE_DT_GET(DT_CHOSEN(zephyr_canbus)) were possible.
Where both devicetree CAN controllers and Kconfig specified CAN loopback
controllers are supported, the macro is replaced with
DT_LABEL(DT_CHOSEN(zephyr_canbus)) for now.
This is the first pass for removing the requirement for devicetree
labels for CAN controllers.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
The fs_statvfs is supposed to return, as all VFS functions, -ENOTSUP
error when underlying file-system driver does not implement the
API call.
The fs_statvfs was returning 0 for success and when API call is not
implemented, which means it is indistinguishable whether stat
structure has been filled by diver with any data or not touched at all.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This commit makes nrf5_config_mac_keys function more generic.
Is uses lookup table for storing keys to override. It removes old keys
before storing new ones.
Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
During stack reset in RCP, the mac keys are resseting my calling
otPlatRadioSetMacKey with aKeyId == 0. aKeyId == 0 was not handling
properly since it is not valid for mac keys. This commit fixes it.
Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
The commit fixes problem with UART TX frame processing, which was
caused by incorrect output buffer size evaulation, where input buffer
of certain len would cause entire output frame to be filled with no
place left for CRC causing a transmission to hang.
The commit, additionally, moves input buffer reminder processing out of
the input buffer processing loop.
Fixes#37893
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Removed some of variables used within the function, and some of
the redundant arithmetic operations.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Move the header file csis.h from the internal location to
the public include directory. This file is supposed to provide
the public API for CSIS and the CSIS client, but is not fully
complete yet.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adds the coordinated set identification service (CSIS) client.
This is still a work in progress and thus there are no public
API for it yet, and some code changes will still be needed.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adds the coordinated set identification service (CSIS) server.
This is still a work in progress and thus there are no public
API for it yet, and some code changes will still be needed.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adding a KConfig to allow for disabling of the passing of invalid SDUs
through the ISOAL HCI data path.
Defaults to keeping current behavior.
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
This is a follow-up to commits 99daca9bba
and ae03c0a6bf.
nRF SPI driver shims cannot use devicetree instance indexes, they need
to use the DT_NODELABEL macro and SoC peripheral instance indexes.
Correct the macros used in initialization of CS GPIOs in those shims.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
A space between :ref: and the actual reference prevented the reference
to be rendered correctly.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Call into z_thread_usage_stop() before ISR entry to avoid including
interrupt handling totals in thread usage stats.
This has to go into the assembly immediately before the callback-based
dispatch. Note that the dispatch code was putting the vector number
in RCX, which was unfortunate as that's a caller-saved register.
Would be nice to clean this up in the future so it lives in a
preserved register but it's mildly complicated to make work with the
way we do the stack layout right now.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Call into z_thread_usage_stop() before ISR entry to avoid including
interrupt handling totals in thread usage stats.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Call into z_thread_usage_stop() before ISR entry to avoid including
interrupt handling totals in thread usage stats.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Call into z_thread_usage_stop() before ISR entry to avoid including
interrupt handling totals in thread usage stats.
This is pretty much exactly where we want it, just after the context
saving steps (which we can't elide since the hook is in C) and
immediately before the tracing hook for ISR entry. And as I'm reading
the code, this is purely for Zephyr-registered interrupts, meaning
that software exceptions will be accounted for (correctly) as part of
the excepting thread.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
It turns out that we have a sample (though not a test) that really
does want to use "k_thread_runtime_stats_all_get()" to measure system
uptime.
Instead of breaking this needlessly, separate the accounting for idle
and non-idle threads. The legacy API can report their sum, and the
more useful value is available via the kernel struct for future
analysis.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
The thread_apis tests of the RUNTIME_STATS feature weren't really
testing the right behavior.
+ It assumed that accounting would only happen at context switch time
and required that the returned values not change for running threads
(even CLEARLY running threads like _current!). But that's not a
documented feature! It's actually sort of a wart that we'd like to
be able to fix (and have fixed, the new backend returns realtime
values so you can track CPU-bound processes on another CPU).
+ It assumed that k_thread_runtime_stats_all_get() would return time
that includes idle time (or conversely it forgot that
k_thread_foreach enumerates over idle threads). This was sort of a
bug in the original (because it means that the result is always the
system uptime multiplied by the number of CPUs)
Broadly, instead of testing the result of a "time" function for
equality (never a good idea) test it via appropriate bounds given the
usage.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Clean up RUNTIME_STATS to separate the API from the individual data
backends. Use the SCHED_THREAD_USAGE tracking instead of the original
for execution_cycles. Move the kconfig for that into the runtime
stats menu, since it's part of the family now.
Also remove a lot of needless #if's around the declarations. Unused
structs and uncalled functions don't need to be explicitly hidden. An
attempt to access a non-existent field (e.g. "execution_cycles" if
that isn't configured) provides all the build time validation we need.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
The runtime stats feature has always supported this, so use the same
kconfig to indirect the timing source in the same way.
(Personally I'm not a fan of the "timing" API, which really doesn't do
anything that the existing core "cycles" API does not except add a
bunch of code due to the separate implementation of frequency
management and conversion routines. It comes from an era where
"cycles" were fixed to a MHz frequency clock on platforms like x86 yet
we had benchmarks that wanted to use the TSC. Those days are behind
us and "cycles" can be fast everywhere.)
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
On older architectures, we don't have the
architecture-independent/scheduler-internal hooks (which require
USE_SWITCH) but there is a hook shared by the tracing layer we can use.
This is sort of a layering violation (stat tracking is a core feature,
tracing is supposed to be optional), but simple and lightweight. And
eventually it will go away as these architectures migrate.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Call into z_thread_usage_stop() before ISR entry to avoid including
interrupt handling totals in thread usage stats.
Note that this hook is after the register save and stack swap has
happened, so it still incldues some overhead. But calling out from
the interrupted stack on Xtensa gets really, really hairy due to the
weird intermediate states we leverage (once we've saved enough context
to make a C call safely, we've lost the ability to use register
windows per the C ABI!).
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This is an alternate backend that does what THREAD_RUNTIME_STATS is
doing currently, but with a few advantages:
* Correctly synchronized: you can't race against a running thread
(potentially on another CPU!) while querying its usage.
* Realtime results: you get the right answer always, up to timer
precision, even if a thread has been running for a while
uninterrupted and hasn't updated its total.
* Portable, no need for per-architecture code at all for the simple
case. (It leverages the USE_SWITCH layer to do this, so won't work
on older architectures)
* Faster/smaller: minimizes use of 64 bit math; lower overhead in
thread struct (keeps the scratch "started" time in the CPU struct
instead). One 64 bit counter per thread and a 32 bit scratch
register in the CPU struct.
* Standalone. It's a core (but optional) scheduler feature, no
dependence on para-kernel configuration like the tracing
infrastructure.
* More precise: allows architectures to optionally call a trivial
zero-argument/no-result cdecl function out of interrupt entry to
avoid accounting for ISR runtime in thread totals. No configuration
needed here, if it's called then you get proper ISR accounting, and
if not you don't.
For right now, pending unification, it's added side-by-side with the
older API and left as a z_*() internal symbol.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Check if the system power management does not interfere with a device
when it has enabled device runtime PM.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Both DRDY and motion interrupts behaves like level signals since they
remain asserted until they're cleared. Configuring them as edge
interrupts is dangerous because if we ever miss an interrupt, it may
never get cleared and thus will never trigger again.
Treating them as edge signals seems to have no advantages, other than
being marginally simpler to implement.
The patch has gotten many hours of run-time on real hardware using a
nRF52-based board and a LIS3DH with both interrupts connected and
heavily utilized.
Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
Add myself (original author) as the maintainer of the task watchdog.
Also including myself as a collaborator to the hardware watchdog
driver, as task watchdog and hardware watchdog are closely related.
Signed-off-by: Martin Jäger <martin@libre.solar>
To prepare for linker script creation with flexible number of linker
passes depending on system configuration then the Zephyr CMake linker
script generator has been updated to use pass names instead of pass
numbers.
This allows greater flexibility as a section can now be active based on
the settings on the pass and not the linking pass index number.
As part of this, the `PASS` processing in `linker_script_common.cmake`
has been adjusted so that it properly handles when a linking pass is
handling multiple settings, such as both `LINKER_APP_SMEM_UNALIGNED`
and `DEVICE_HANDLES_PASS1` in same linking pass.
As the number of linking passes are more flexible, then the PASS
argument in `zephyr_linker_section()` and
`zephyr_linker_section_configure()` has been updated to also support
a `NOT <name>` argument, for example: `PASS NOT LINKER_ZEPHYR_FINAL`.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit clean up the creation and use of kobj_hash_output_lib and
kobj_prebuilt_hash_output_lib libraries.
It also removes the use of kobj_hash_output_lib_interface and
kobj_prebuilt_hash_output_lib_interface interface libraries.
The kobj_hash_output_lib_interface was originally introduced as part
of the KBuild re-write 12f8f76165 where
the interface lib was used to ensure compile definition order on build
invocation.
However, this became obsolete with the commit
4b3c7b3d17 as that commit moved the
compile flags from the interface lib to directly set them using the
`set_source_files_properties()` function.
Therefore the interface libs have now been removed and instead include
directories and compile definitions are added to the kobj hash libraries
using generator expression.
Using generator expressions further remove the need for `get_property()`
on the zephyr interface library.
The kobj hash libraries has been changed from a STATIC library because
it is not linked as a library anywhere. Only the object files
kobject_hash.c.obj and kobject_prebuilt_hash.c.obj are used by custom
commands. Using an CMake object library removes the need for knowing the
final location and name of the object file as this can be retrieved
directly from the object library when needed using: `TARGET_OBJECTS`
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Currently all calls to `configure_linker_script()` specifies `-D<name>`
when calling `configure_linker_script()`.
This works well for the gcc pre-processed ld linker script templates,
but Zephyr also supports a CMake linker script generator which can be
used for ld scripts and armlink scatter files.
In this case, a `-D` must be stripped.
This commit changes this so that Zephyr CMake build system calls
`configure_linker_script()` without `-D`.
Thus the `LINKER_SCRIPT` choice can decide how this information should
be passed to underlying linker script functionality, that is `-D` for
linker script template and CMake variable for the CMake linker script
generator.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
The cycle64 sample is intended to complement
`test_clock_cycle_64()` in `tests/kernel/common`.
The sample demonstrates the upper 32-bits of the 64-bit cycle
counter incrementing when the bottom 32-bits roll over from
`UINT32_MAX` to 0.
If the upper 32-bits of the 64-bit cycle counter does not
increment, then an error message is printed.
```
west build -p auto -b qemu_cortex_a53 -t run \
samples/kernel/cycle64
...
*** Booting Zephyr OS build v2.7.99-1124-gd7ba4e394832 ***
wrap-around should occur in 68s
[ddd:hh:mm:ss.0ms]
[000:00:00:00.020]: c64: 0000000000174258
[000:00:01:08.760]: c64: 000000010027f8bb
[000:00:02:17.490]: c64: 0000000200348c85
```
Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>