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)
444 return api->
enqueue(dev, vbuf);
469 return api->
dequeue(dev, vbuf, timeout);
490 if (api->
flush == NULL) {
494 return api->
flush(dev, cancel);
707#define VIDEO_MIPI_CSI2_DT_NULL 0x10
709#define VIDEO_MIPI_CSI2_DT_BLANKING 0x11
711#define VIDEO_MIPI_CSI2_DT_EMBEDDED_8 0x12
713#define VIDEO_MIPI_CSI2_DT_YUV420_8 0x18
715#define VIDEO_MIPI_CSI2_DT_YUV420_10 0x19
717#define VIDEO_MIPI_CSI2_DT_YUV420_CSPS_8 0x1c
719#define VIDEO_MIPI_CSI2_DT_YUV420_CSPS_10 0x1d
721#define VIDEO_MIPI_CSI2_DT_YUV422_8 0x1e
723#define VIDEO_MIPI_CSI2_DT_YUV422_10 0x1f
725#define VIDEO_MIPI_CSI2_DT_RGB444 0x20
727#define VIDEO_MIPI_CSI2_DT_RGB555 0x21
729#define VIDEO_MIPI_CSI2_DT_RGB565 0x22
731#define VIDEO_MIPI_CSI2_DT_RGB666 0x23
733#define VIDEO_MIPI_CSI2_DT_RGB888 0x24
735#define VIDEO_MIPI_CSI2_DT_RAW6 0x28
737#define VIDEO_MIPI_CSI2_DT_RAW7 0x29
739#define VIDEO_MIPI_CSI2_DT_RAW8 0x2a
741#define VIDEO_MIPI_CSI2_DT_RAW10 0x2b
743#define VIDEO_MIPI_CSI2_DT_RAW12 0x2c
745#define VIDEO_MIPI_CSI2_DT_RAW14 0x2d
809#define VIDEO_MIPI_CSI2_DT_USER(n) (0x30 + (n))
APIs and macros for the Zephyr device model.
#define DEVICE_API_GET(_class, _dev)
Expands to the pointer of a device's API for a given class.
Definition device.h:1505
Header file for the doubly-linked list API.
struct _dnode sys_dnode_t
Doubly-linked list node structure.
Definition dlist.h:59
struct _dnode sys_dlist_t
Doubly-linked list structure.
Definition dlist.h:55
#define ENOSYS
Function not implemented.
Definition errno.h:83
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:172
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:210
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:216
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:184
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:204
int(* video_api_format_t)(const struct device *dev, struct video_format *fmt)
Callback API to set or get video format.
Definition video.h:160
int(* video_api_flush_t)(const struct device *dev, bool cancel)
Callback API to flush endpoint buffers.
Definition video.h:191
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:231
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:197
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:225
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:178
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:166
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
#define VIDEO_MIPI_CSI2_DT_RGB888
RGB format with 8 bits per color component.
Definition video.h:733
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:533
#define VIDEO_MIPI_CSI2_DT_YUV422_8
YUV 4:2:2 format with 8 bits per component.
Definition video.h:721
static int video_driver_get_selection(const struct device *dev, struct video_selection *sel)
Get video selection (crop/compose).
Definition video.h:684
static int video_driver_set_ctrl(const struct device *dev, uint32_t cid)
Set a video control value of a driver.
Definition video.h:556
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:602
static int video_driver_enum_frmival(const struct device *dev, struct video_frmival_enum *fie)
List video frame intervals.
Definition video.h:412
#define VIDEO_MIPI_CSI2_DT_RAW14
Raw sensor data with 14 bits per pixel.
Definition video.h:745
struct video_device * video_find_vdev(const struct device *dev)
Find the video_device associated with a video device.
static int video_driver_get_frmival(const struct device *dev, struct video_frmival *frmival)
Get video frame interval of a driver.
Definition video.h:386
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:364
#define VIDEO_MIPI_CSI2_DT_NULL
NULL data type - used for padding or synchronization.
Definition video.h:707
#define VIDEO_MIPI_CSI2_DT_RAW10
Raw sensor data with 10 bits per pixel.
Definition video.h:741
#define VIDEO_MIPI_CSI2_DT_RAW8
Raw sensor data with 8 bits per pixel.
Definition video.h:739
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:629
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:576
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:509
static int video_driver_flush(const struct device *dev, bool cancel)
Flush endpoint buffers from a driver.
Definition video.h:486
static int video_driver_set_format(const struct device *dev, struct video_format *fmt)
Set video format of a driver.
Definition video.h:319
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:460
static int video_driver_get_format(const struct device *dev, struct video_format *fmt)
Get video format of a driver.
Definition video.h:341
static uint8_t video_mipi_data_type(uint32_t pixfmt)
Map pixel formats to their MIPI data type equivalent.
Definition video.h:760
#define VIDEO_MIPI_CSI2_DT_RGB565
RGB format with 5-6-5 bits per R-G-B components.
Definition video.h:729
#define VIDEO_MIPI_CSI2_DT_RAW12
Raw sensor data with 12 bits per pixel.
Definition video.h:743
static int video_driver_enqueue(const struct device *dev, struct video_buffer *vbuf)
Pass a video buffer to a driver.
Definition video.h:436
static int video_driver_set_selection(const struct device *dev, struct video_selection *sel)
Set video selection (crop/compose).
Definition video.h:657
video_buf_type
video_buf_type enum
Definition types.h:42
__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:543
Poll signal object.
Definition kernel.h:7064
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:124
unsigned long flags
Flags associated with this control.
Definition video.h:126
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:134
uint32_t id
Control ID, see Video Control IDs.
Definition video.h:122
const char *const * menu
Used for menu control types.
Definition video.h:139
int32_t val
Used for 32-bit control types.
Definition video.h:132
struct video_ctrl_range range
Acceptable range of values for this control.
Definition video.h:128
const int64_t * int_menu
Used for integer menu control types.
Definition video.h:141
const struct video_device * vdev
Video device associated with this control.
Definition video.h:120
bool has_volatiles
Internal use for volatile control handling.
Definition video.h:117
sys_dnode_t node
Node place this control in a list.
Definition video.h:144
struct video_ctrl * cluster
Internal use for video control grouping.
Definition video.h:109
int32_t manual_val
Internal use: value of the primary control that selects manual mode.
Definition video.h:115
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
<span class="mlabel">Driver Operations</span> Video driver operations
Definition video.h:236
video_api_transform_cap_t transform_cap
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:300
video_api_format_t set_format
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition video.h:240
video_api_ctrl_t set_ctrl
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:268
video_api_enqueue_t enqueue
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:256
video_api_set_signal_t set_signal
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:276
video_api_enum_frmival_t enum_frmival
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:288
video_api_get_caps_t get_caps
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition video.h:252
video_api_selection_t get_selection
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:296
video_api_selection_t set_selection
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:292
video_api_format_t get_format
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition video.h:244
video_api_flush_t flush
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:264
video_api_dequeue_t dequeue
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:260
video_api_frmival_t get_frmival
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:284
video_api_frmival_t set_frmival
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:280
video_api_set_stream_t set_stream
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition video.h:248
video_api_ctrl_t get_volatile_ctrl
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:272
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