Browse Source
Introduce a new video device structure representing a device in a video pipeline. Each video device embeds a pointer to its "source" device and other "video" characteristics. This structure give the video framework an access to all video features of the device and a hierachical view of the video pipeline that the device belongs to. Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>pull/85634/merge
19 changed files with 139 additions and 24 deletions
@ -0,0 +1,3 @@ |
|||||||
|
#include <zephyr/linker/iterable_sections.h> |
||||||
|
|
||||||
|
ITERABLE_SECTION_RAM(video_device, Z_LINK_ITERABLE_SUBALIGN) |
@ -0,0 +1,22 @@ |
|||||||
|
/*
|
||||||
|
* Copyright 2025 NXP |
||||||
|
* |
||||||
|
* SPDX-License-Identifier: Apache-2.0 |
||||||
|
*/ |
||||||
|
|
||||||
|
#include "video_device.h" |
||||||
|
|
||||||
|
struct video_device *video_find_vdev(const struct device *dev) |
||||||
|
{ |
||||||
|
if (!dev) { |
||||||
|
return NULL; |
||||||
|
} |
||||||
|
|
||||||
|
STRUCT_SECTION_FOREACH(video_device, vdev) { |
||||||
|
if (vdev->dev == dev) { |
||||||
|
return vdev; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return NULL; |
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
/*
|
||||||
|
* Copyright 2025 NXP |
||||||
|
* |
||||||
|
* SPDX-License-Identifier: Apache-2.0 |
||||||
|
*/ |
||||||
|
|
||||||
|
#ifndef ZEPHYR_INCLUDE_DRIVERS_VIDEO_VIDEO_DEVICE_H_ |
||||||
|
#define ZEPHYR_INCLUDE_DRIVERS_VIDEO_VIDEO_DEVICE_H_ |
||||||
|
|
||||||
|
#include <zephyr/device.h> |
||||||
|
|
||||||
|
struct video_device { |
||||||
|
const struct device *dev; |
||||||
|
const struct device *src_dev; |
||||||
|
}; |
||||||
|
|
||||||
|
#define VIDEO_DEVICE_DEFINE(name, device, source) \ |
||||||
|
static STRUCT_SECTION_ITERABLE(video_device, name) = { \ |
||||||
|
.dev = device, \ |
||||||
|
.src_dev = source, \ |
||||||
|
} |
||||||
|
|
||||||
|
struct video_device *video_find_vdev(const struct device *dev); |
||||||
|
|
||||||
|
#endif /* ZEPHYR_INCLUDE_DRIVERS_VIDEO_VIDEO_DEVICE_H_ */ |
Loading…
Reference in new issue