15#ifndef ZEPHYR_INCLUDE_DRIVERS_VIDEO_H
16#define ZEPHYR_INCLUDE_DRIVERS_VIDEO_H
72#define VIDEO_CTRL_FLAG_READ_ONLY BIT(0)
74#define VIDEO_CTRL_FLAG_WRITE_ONLY BIT(1)
76#define VIDEO_CTRL_FLAG_VOLATILE BIT(2)
78#define VIDEO_CTRL_FLAG_INACTIVE BIT(3)
80#define VIDEO_CTRL_FLAG_UPDATE BIT(4)
442 return api->
enqueue(dev, vbuf);
467 return api->
dequeue(dev, vbuf, timeout);
492 return api->
flush(dev, cancel);
705#define VIDEO_MIPI_CSI2_DT_NULL 0x10
707#define VIDEO_MIPI_CSI2_DT_BLANKING 0x11
709#define VIDEO_MIPI_CSI2_DT_EMBEDDED_8 0x12
711#define VIDEO_MIPI_CSI2_DT_YUV420_8 0x18
713#define VIDEO_MIPI_CSI2_DT_YUV420_10 0x19
715#define VIDEO_MIPI_CSI2_DT_YUV420_CSPS_8 0x1c
717#define VIDEO_MIPI_CSI2_DT_YUV420_CSPS_10 0x1d
719#define VIDEO_MIPI_CSI2_DT_YUV422_8 0x1e
721#define VIDEO_MIPI_CSI2_DT_YUV422_10 0x1f
723#define VIDEO_MIPI_CSI2_DT_RGB444 0x20
725#define VIDEO_MIPI_CSI2_DT_RGB555 0x21
727#define VIDEO_MIPI_CSI2_DT_RGB565 0x22
729#define VIDEO_MIPI_CSI2_DT_RGB666 0x23
731#define VIDEO_MIPI_CSI2_DT_RGB888 0x24
733#define VIDEO_MIPI_CSI2_DT_RAW6 0x28
735#define VIDEO_MIPI_CSI2_DT_RAW7 0x29
737#define VIDEO_MIPI_CSI2_DT_RAW8 0x2a
739#define VIDEO_MIPI_CSI2_DT_RAW10 0x2b
741#define VIDEO_MIPI_CSI2_DT_RAW12 0x2c
743#define VIDEO_MIPI_CSI2_DT_RAW14 0x2d
807#define VIDEO_MIPI_CSI2_DT_USER(n) (0x30 + (n))
#define DEVICE_API_GET(_class, _dev)
Expands to the pointer of a device's API for a given class.
Definition device.h:1425
Header file for the doubly-linked list API.
struct _dnode sys_dnode_t
Doubly-linked list node structure.
Definition dlist.h:57
struct _dnode sys_dlist_t
Doubly-linked list structure.
Definition dlist.h:53
#define ENOSYS
Function not implemented.
Definition errno.h:83
video_ctrl_type
Type of video control.
Definition video.h:87
@ VIDEO_CTRL_TYPE_MENU
Menu string type, standard or driver-defined menu.
Definition video.h:95
@ VIDEO_CTRL_TYPE_STRING
String type.
Definition video.h:97
@ VIDEO_CTRL_TYPE_INTEGER
Integer type.
Definition video.h:91
@ VIDEO_CTRL_TYPE_INTEGER_MENU
Menu integer type, standard or driver-defined menu.
Definition video.h:99
@ VIDEO_CTRL_TYPE_BOOLEAN
Boolean type.
Definition video.h:89
@ VIDEO_CTRL_TYPE_INTEGER64
64-bit integer type
Definition video.h:93
int(* video_api_enum_frmival_t)(const struct device *dev, struct video_frmival_enum *fie)
Callback API to enumerate supported frame intervals for a format.
Definition video.h:170
int(* video_api_get_caps_t)(const struct device *dev, struct video_caps *caps)
Callback API to get capabilities of a video endpoint.
Definition video.h:208
int(* video_api_transform_cap_t)(const struct device *const dev, const struct video_format_cap *const cap, struct video_format_cap *const res_cap, enum video_buf_type type, uint16_t ind)
Callback API to transform a format capability across m2m device endpoints.
Definition video.h:214
#define VIDEO_MIPI_CSI2_DT_RGB888
RGB format with 8 bits per color component.
Definition video.h:731
static int video_driver_get_volatile_ctrl(const struct device *dev, uint32_t cid)
Get a volatile video control value of a driver.
Definition video.h:531
#define VIDEO_MIPI_CSI2_DT_YUV422_8
YUV 4:2:2 format with 8 bits per component.
Definition video.h:719
static int video_driver_get_selection(const struct device *dev, struct video_selection *sel)
Get video selection (crop/compose).
Definition video.h:682
static int video_driver_set_ctrl(const struct device *dev, uint32_t cid)
Set a video control value of a driver.
Definition video.h:554
static int video_driver_transform_cap(const struct device *const dev, const struct video_format_cap *const cap, struct video_format_cap *const res_cap, enum video_buf_type type, uint16_t ind)
Transform a video format capability from one end to the other end of a m2m video device.
Definition video.h:600
static int video_driver_enum_frmival(const struct device *dev, struct video_frmival_enum *fie)
List video frame intervals.
Definition video.h:410
#define VIDEO_MIPI_CSI2_DT_RAW14
Raw sensor data with 14 bits per pixel.
Definition video.h:743
struct video_device * video_find_vdev(const struct device *dev)
Find the video_device associated with a video device.
int(* video_api_dequeue_t)(const struct device *dev, struct video_buffer **buf, k_timeout_t timeout)
Callback API to dequeue a buffer from the driver outgoing queue.
Definition video.h:182
static int video_driver_get_frmival(const struct device *dev, struct video_frmival *frmival)
Get video frame interval of a driver.
Definition video.h:384
int(* video_api_ctrl_t)(const struct device *dev, uint32_t cid)
Callback API to set or get a video control value.
Definition video.h:202
static int video_driver_set_frmival(const struct device *dev, struct video_frmival *frmival)
Apply a video frame interval to a driver.
Definition video.h:362
#define VIDEO_MIPI_CSI2_DT_NULL
NULL data type - used for padding or synchronization.
Definition video.h:705
#define VIDEO_MIPI_CSI2_DT_RAW10
Raw sensor data with 10 bits per pixel.
Definition video.h:739
#define VIDEO_MIPI_CSI2_DT_RAW8
Raw sensor data with 8 bits per pixel.
Definition video.h:737
static int video_driver_set_signal(const struct device *dev, struct k_poll_signal *sig)
Register/Unregister k_poll signal for a video endpoint.
Definition video.h:627
static int video_driver_get_caps(const struct device *dev, struct video_caps *caps)
Get the capabilities of a video driver endpoint.
Definition video.h:574
static int video_driver_set_stream(const struct device *dev, bool enable, enum video_buf_type type)
Start or stop the video driver function.
Definition video.h:507
static int video_driver_flush(const struct device *dev, bool cancel)
Flush endpoint buffers from a driver.
Definition video.h:484
int(* video_api_format_t)(const struct device *dev, struct video_format *fmt)
@def_driverbackendgroup{Video,video_interface}
Definition video.h:158
int(* video_api_flush_t)(const struct device *dev, bool cancel)
Callback API to flush endpoint buffers.
Definition video.h:189
static int video_driver_set_format(const struct device *dev, struct video_format *fmt)
Set video format of a driver.
Definition video.h:317
static int video_driver_dequeue(const struct device *dev, struct video_buffer **vbuf, k_timeout_t timeout)
Dequeue a video buffer from a driver.
Definition video.h:458
int(* video_api_selection_t)(const struct device *dev, struct video_selection *sel)
Callback API to set or get video selection (crop/compose).
Definition video.h:229
static int video_driver_get_format(const struct device *dev, struct video_format *fmt)
Get video format of a driver.
Definition video.h:339
static uint8_t video_mipi_data_type(uint32_t pixfmt)
Map pixel formats to their MIPI data type equivalent.
Definition video.h:758
int(* video_api_set_stream_t)(const struct device *dev, bool enable, enum video_buf_type type)
Callback API to control stream status.
Definition video.h:195
int(* video_api_set_signal_t)(const struct device *dev, struct k_poll_signal *sig)
Callback API to register or unregister poll signal for buffer events.
Definition video.h:223
#define VIDEO_MIPI_CSI2_DT_RGB565
RGB format with 5-6-5 bits per R-G-B components.
Definition video.h:727
#define VIDEO_MIPI_CSI2_DT_RAW12
Raw sensor data with 12 bits per pixel.
Definition video.h:741
int(* video_api_enqueue_t)(const struct device *dev, struct video_buffer *buf)
Callback API to enqueue a buffer in the driver incoming queue.
Definition video.h:176
static int video_driver_enqueue(const struct device *dev, struct video_buffer *vbuf)
Pass a video buffer to a driver.
Definition video.h:434
int(* video_api_frmival_t)(const struct device *dev, struct video_frmival *frmival)
Callback API to set or get video frame interval.
Definition video.h:164
static int video_driver_set_selection(const struct device *dev, struct video_selection *sel)
Set video selection (crop/compose).
Definition video.h:655
video_buf_type
video_buf_type enum
Definition types.h:42
#define NULL
Definition iar_missing_defs.h:20
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__INT32_TYPE__ int32_t
Definition stdint.h:74
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
__INT64_TYPE__ int64_t
Definition stdint.h:75
Runtime device structure (in ROM) per driver instance.
Definition device.h:513
Poll signal object.
Definition kernel.h:6798
Kernel timeout type.
Definition clock.h:65
Video buffer structure.
Definition types.h:66
Video format capabilities.
Definition types.h:157
Video control range structure.
Definition types.h:175
Storage type for video controls.
Definition video.h:107
bool is_auto
Internal use for auto control handling.
Definition video.h:113
enum video_ctrl_type type
Type of the control.
Definition video.h:122
unsigned long flags
Flags associated with this control.
Definition video.h:124
uint8_t cluster_sz
Internal use for video control grouping.
Definition video.h:111
int64_t val64
Used for 64-bit control types.
Definition video.h:132
uint32_t id
Control ID, see Video Control IDs.
Definition video.h:120
const char *const * menu
Used for menu control types.
Definition video.h:137
int32_t val
Used for 32-bit control types.
Definition video.h:130
struct video_ctrl_range range
Acceptable range of values for this control.
Definition video.h:126
const int64_t * int_menu
Used for integer menu control types.
Definition video.h:139
const struct video_device * vdev
Video device associated with this control.
Definition video.h:118
bool has_volatiles
Internal use for volatile control handling.
Definition video.h:115
sys_dnode_t node
Node place this control in a list.
Definition video.h:142
struct video_ctrl * cluster
Internal use for video control grouping.
Definition video.h:109
Storage type for a wrapper type around a video device.
Definition video.h:46
const struct device * dev
Device held by this video device.
Definition video.h:48
const struct device * src_dev
Source device up in the chain, and providing the data.
Definition video.h:50
sys_dlist_t ctrls
List of video controls supported by this device.
Definition video.h:52
@driver_ops{Video}
Definition video.h:234
video_api_transform_cap_t transform_cap
@driver_ops_optional Transform a video format capability from one end to the other end of a m2m vid...
Definition video.h:298
video_api_format_t set_format
@driver_ops_mandatory Set video format of a driver.
Definition video.h:238
video_api_ctrl_t set_ctrl
@driver_ops_optional Set a video control value of a driver.
Definition video.h:266
video_api_enqueue_t enqueue
@driver_ops_optional Pass a video buffer to a driver.
Definition video.h:254
video_api_set_signal_t set_signal
@driver_ops_optional Register/Unregister k_poll signal for a video endpoint.
Definition video.h:274
video_api_enum_frmival_t enum_frmival
@driver_ops_optional List video frame intervals.
Definition video.h:286
video_api_get_caps_t get_caps
@driver_ops_mandatory Get the capabilities of a video driver endpoint.
Definition video.h:250
video_api_selection_t get_selection
@driver_ops_optional Get video selection (crop/compose).
Definition video.h:294
video_api_selection_t set_selection
@driver_ops_optional Set video selection (crop/compose).
Definition video.h:290
video_api_format_t get_format
@driver_ops_mandatory Get video format of a driver.
Definition video.h:242
video_api_flush_t flush
@driver_ops_optional Flush endpoint buffers from a driver.
Definition video.h:262
video_api_dequeue_t dequeue
@driver_ops_optional Dequeue a video buffer from a driver.
Definition video.h:258
video_api_frmival_t get_frmival
@driver_ops_optional Get video frame interval of a driver.
Definition video.h:282
video_api_frmival_t set_frmival
@driver_ops_optional Apply a video frame interval to a driver.
Definition video.h:278
video_api_set_stream_t set_stream
@driver_ops_mandatory Start or stop the video driver function.
Definition video.h:246
video_api_ctrl_t get_volatile_ctrl
@driver_ops_optional Get a volatile video control value of a driver.
Definition video.h:270
Video frame interval enumeration structure.
Definition types.h:341
Video frame interval structure.
Definition types.h:315
Video selection (crop / compose) structure.
Definition types.h:291