Add a k_timeout_t type, and use it everywhere that kernel API
functions were accepting a millisecond timeout argument. Instead of
forcing milliseconds everywhere (which are often not integrally
representable as system ticks), do the conversion to ticks at the
point where the timeout is created. This avoids an extra unit
conversion in some application code, and allows us to express the
timeout in units other than milliseconds to achieve greater precision.
The existing K_MSEC() et. al. macros now return initializers for a
k_timeout_t.
The K_NO_WAIT and K_FOREVER constants have now become k_timeout_t
values, which means they cannot be operated on as integers.
Applications which have their own APIs that need to inspect these
vs. user-provided timeouts can now use a K_TIMEOUT_EQ() predicate to
test for equality.
Timer drivers, which receive an integer tick count in ther
z_clock_set_timeout() functions, now use the integer-valued
K_TICKS_FOREVER constant instead of K_FOREVER.
For the initial release, to preserve source compatibility, a
CONFIG_LEGACY_TIMEOUT_API kconfig is provided. When true, the
k_timeout_t will remain a compatible 32 bit value that will work with
any legacy Zephyr application.
Some subsystems present timeout (or timeout-like) values to their own
users as APIs that would re-use the kernel's own constants and
conventions. These will require some minor design work to adapt to
the new scheme (in most cases just using k_timeout_t directly in their
own API), and they have not been changed in this patch, instead
selecting CONFIG_LEGACY_TIMEOUT_API via kconfig. These subsystems
include: CAN Bus, the Microbit display driver, I2S, LoRa modem
drivers, the UART Async API, Video hardware drivers, the console
subsystem, and the network buffer abstraction.
k_sleep() now takes a k_timeout_t argument, with a k_msleep() variant
provided that works identically to the original API.
Most of the changes here are just type/configuration management and
documentation, but there are logic changes in mempool, where a loop
that used a timeout numerically has been reworked using a new
z_timeout_end_calc() predicate. Also in queue.c, a (when POLL was
enabled) a similar loop was needlessly used to try to retry the
k_poll() call after a spurious failure. But k_poll() does not fail
spuriously, so the loop was removed.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
With new NXP HAL, MCUX CSI does not necesseraly start the
capture into the first submitted buffer. However the driver
expects that buffers will be captured in submitted order.
Fix that.
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
k_mem_pool_malloc reserves some space for block descriptor at the start
of the data block, causing misalignement of returned video buffer.
In our context we want to return a video buffer with aligment matching
the video buffer poll alignment config. Fix that by using the simpler
k_mem_pool_alloc function.
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Use this short header style in all Kconfig files:
# <description>
# <copyright>
# <license>
...
Also change all <description>s from
# Kconfig[.extension] - Foo-related options
to just
# Foo-related options
It's clear enough that it's about Kconfig.
The <description> cleanup was done with this command, along with some
manual cleanup (big letter at the start, etc.)
git ls-files '*Kconfig*' | \
xargs sed -i -E '1 s/#\s*Kconfig[\w.-]*\s*-\s*/# /'
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Same deal as in commit 677f1e6db9 ("config: Turn pointless/confusing
'menuconfig's into 'config's"), for some newly introduced (or maybe
overlooked) stuff.
Also clean up formatting a bit, replacing spaces with tabs and
shortening the header.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This is a virtual device generating video pattern for testing
purpose. It supports colobar pattern for now.
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
MT9M114 is a CMOS digital image sensor.
Implement video interface.
Only VGA (640x480) supported for now.
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>