Commit graph

26 commits

Author SHA1 Message Date
Phi Bang Nguyen 727f04b159 samples: video: capture: Add support for i.MX RT1170 EVK
Add support for i.MX RT1170 EVK

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-06-14 19:20:08 +02:00
Phi Bang Nguyen 831f5f6ba6 samples: video: capture: Display captured frames on screen
Improve the sample application by displaying the captured frames instead
of just discarding them.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-06-14 19:20:08 +02:00
Phi Bang Nguyen 0ecbd0b9c9 samples: video: capture: Use a chosen node for camera
In order to be generic, use a chosen node for camera so that the sample
is not specific to NXP SoCs. Also, always favorite a real video device
unless it is unavailable.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-06-14 19:20:08 +02:00
Phi Bang Nguyen 553f527a49 samples: video: capture: Enhance logs readability
There are some compatibilty situations where carriage return does not
work (e.g. on Serial Monitor in VSCode). Moreover, keeping the
timestamps logs on the console would help to have an idea about the
frame rate. So, it's better to use line feed instead of carriage return
in this case.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-06-14 19:20:08 +02:00
Phi Bang Nguyen ee3347a9f3 samples: video: capture: Run clang-format
Run clang-format on the file before making any changes

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-06-14 19:20:08 +02:00
Phi Bang Nguyen 96d8330d9b samples: video: capture: Update documents and tests
The mt9m114 camera shield is now added. There are also some changes in
the mt9m114 camera driver, e.g. frame rate, default format, capabilities.
Update the sample document and test to reflect these changes.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-06-14 19:20:08 +02:00
Phi Bang Nguyen 70c0c334a4 samples: video: tcpserversink: Add support for software generator
Add support for video software generator in case of a real video capture
device is missing.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-06-06 15:20:37 -05:00
Phi Bang Nguyen 020ffe6104 samples: video: tcpserversink: Use mt9m114 camera shield
Update the sample to use a camera shield with a camera chosen node.
This is not only because the camera nodes in the mimxrt1064 device
tree has been now moved to a separate mt9m114 shield but also to
make the sample more generic.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-06-06 15:20:37 -05:00
Phi Bang Nguyen 7ece993029 samples: video: tcpserversink: Update default camera resolution
The default resolution of mt9m114 camera is now changed to 480x272.
Update the sample documentation to reflect this change.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-06-06 15:20:37 -05:00
Phi Bang Nguyen ba1d5fcc86 samples: video: tcpserversink: Add a new line after printk
Add a new line so that logs are easier to be read.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-06-06 15:20:37 -05:00
Phi Bang Nguyen 3bf11d19dc samples: video: tcpserversink: Run clang-format
Run clang-format before making any changes

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-06-06 15:20:37 -05:00
Chris Friedt bc4374b5fe posix: deprecate POSIX_MAX_FDS and add POSIX_DEVICE_IO
The POSIX_MAX_FDS option does not correspond to any standard
POSIX option. It was used to define the size of the file
descriptor table, which is by no means exclusively used by
POSIX (also net, fs, ...).

POSIX_MAX_FDS is being deprecated in order to ensure that
Zephyr's POSIX Kconfig variables correspond to those defined in
the specification, as of IEEE 1003.1-2017. Namely,
POSIX_OPEN_MAX. CONFIG_POSIX_MAX_OPEN_FILES is being deprecated
for the same reason.

To mitigate any possible layering violations, that option is
not user selectable. It tracks the newly added
CONFIG_ZVFS_OPEN_MAX option, which is native to Zephyr.

With this deprecation, we introduce the following Kconfig
options that map directly to standard POSIX Option Groups by
simply removing "CONFIG_":

* CONFIG_POSIX_DEVICE_IO

Similarly, with this deprecation, we introduce the following
Kconfig options that map directly to standard POSIX Options by
simply removing "CONFIG":

* CONFIG_POSIX_OPEN_MAX

In order to maintain parity with the current feature set, we
introduce the following Kconfig options.

* CONFIG_POSIX_DEVICE_IO_ALIAS_CLOSE
* CONFIG_POSIX_DEVICE_IO_ALIAS_OPEN
* CONFIG_POSIX_DEVICE_IO_ALIAS_READ
* CONFIG_POSIX_DEVICE_IO_ALIAS_WRITE

Gate open(), close(), read(), and write() via the
CONFIG_POSIX_DEVICE_IO Kconfig option and move
implementations into device_io.c, to be conformant with the
spec.

Lastly, stage function names for upcoming ZVFS work, to be
completed as part of the LTSv3 Roadmap (e.g. zvfs_open(), ..).

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-06-04 16:27:12 -05:00
Chris Friedt 37e82fcb21 samples: video: tcpserversink: fix build failure
The nxp,imx-csi node was removed from dts in a previous commit
which caused a build failure / regression in CI.

Use DEVICE_DT_GET_ANY() instead of DEVICE_DT_GET_ONE(), since
the latter requires a DT node present, while the former does
not and returns NULL if no such compat exists.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-06-01 09:42:29 -07:00
Jukka Rissanen 5c3fa85bc8 samples: net: Change to use CONFIG_POSIX_API
Change the sample applications that use network socket API to
use the POSIX_API config because the NET_SOCKETS_POSIX_NAMES is
deprecated. Convert also the zsock_ API calls to plain BSD
socket API calls when applicable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Benjamin Cabé b0f92e13b9 doc: video: samples: Use new Sphinx extension to document samples
Use the new code-sample directive and roles to document the video
capture samples so that they show up as "Related samples" when browsing
the API documentation.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-09-19 15:22:37 +01:00
Nerijus Bendžiūnas 397ed142ad doc: fix :zephyr-app: paths
During testing I've found one bad path and looked if
there is more.

I've used this oneliner to find more:

```
rg :zephyr-app: | awk '{ print $3 }' | while read dir
do
    test -d $dir || echo $dir
done | grep '^samples' | grep -v '<' | sort | uniq

```

Signed-off-by: Nerijus Bendžiūnas <nerijus.bendziunas@gmail.com>
2023-07-17 16:51:16 -04:00
Gerard Marull-Paretas 93b63df762 samples, tests: convert string-based twister lists to YAML lists
Twister now supports using YAML lists for all fields that were written
as space-separated lists. Used twister_to_list.py script. Some artifacts
on string length are due to how ruamel dumps content.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-10 09:52:37 +02:00
Keith Packard 0b90fd5adf samples, tests, boards: Switch main return type from void to int
As both C and C++ standards require applications running under an OS to
return 'int', adapt that for Zephyr to align with those standard. This also
eliminates errors when building with clang when not using -ffreestanding,
and reduces the need for compiler flags to silence warnings for both clang
and gcc.

Most of these changes were automated using coccinelle with the following
script:

@@
@@
- void
+ int
main(...) {
	...
-	return;
+	return 0;
	...
}

Approximately 40 files had to be edited by hand as coccinelle was unable to
fix them.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-14 07:49:41 +09:00
Anas Nashif ba7d730e9b tests/samples: use integration_plaforms in more tests/samples
integration_platforms help us control what get built/executed in CI and
for each PR submitted. They do not filter out platforms, instead they
just minimize the amount of builds/testing for a particular
tests/sample.
Tests still run on all supported platforms when not in integration mode.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-29 16:03:23 +01:00
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Gerard Marull-Paretas a202341958 devices: constify device pointers initialized at compile time
Many device pointers are initialized at compile and never changed. This
means that the device pointer can be constified (immutable).

Automated using:

```
perl -i -pe 's/const struct device \*(?!const)(.*)= DEVICE/const struct
device *const $1= DEVICE/g' **/*.c
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-22 17:08:26 +02:00
Kumar Gala 632069b3de video: remove defconfig/proj setting of video drivers
Now that video drivers are enabled based on devicetree we can
remove any cases of them getting enabled by proj.conf files.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-14 09:05:36 -05:00
Kumar Gala 4fab930c6d samples: video: Convert to use DEVICE_DT_GET_ONE
Move to use DEVICE_DT_GET_ONE instead of device_get_binding as
we work on phasing out use of DTS 'label' property.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-12 10:20:00 +02:00
Gerard Marull-Paretas c7b5b3c419 samples: migrate includes to contain <zephyr/...> prefix
In order to bring consistency in-tree, migrate all samples to the use
the new prefix <zephyr/...>. Note that the conversion has been scripted:

```python
from pathlib import Path
import re

EXTENSIONS = ("c", "h", "cpp", "rst")

for p in Path(".").glob("samples/**/*"):
    if not p.is_file() or p.suffix and p.suffix[1:] not in EXTENSIONS:
        continue

    content = ""
    with open(p) as f:
        for line in f:
            m = re.match(r"^(.*)#include <(.*)>(.*)$", line)
            if (m and
                not m.group(2).startswith("zephyr/") and
                (Path(".") / "include" / "zephyr" / m.group(2)).exists()):
                content += (
                    m.group(1) +
                    "#include <zephyr/" + m.group(2) +">" +
                    m.group(3) + "\n"
                )
            else:
                content += line

    with open(p, "w") as f:
        f.write(content)
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 11:29:59 +02:00
Torsten Rasmussen 1cccc8a8fe cmake: increase minimal required version to 3.20.0
Move to CMake 3.20.0.

At the Toolchain WG it was decided to move to CMake 3.20.0.

The main reason for increasing CMake version is better toolchain
support.

Better toolchain support is added in the following CMake versions:
- armclang, CMake 3.15
- Intel oneAPI, CMake 3.20
- IAR, CMake 3.15 and 3.20

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-20 09:47:34 +02:00
Anas Nashif a221d5326a sampels: move video into subsys/video
Move video samples under subsys/video.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-09 17:48:18 -05:00