Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef __LINUX_UVCVIDEO_H_
0003 #define __LINUX_UVCVIDEO_H_
0004 
0005 #include <linux/ioctl.h>
0006 #include <linux/types.h>
0007 
0008 /*
0009  * Dynamic controls
0010  */
0011 
0012 /* Data types for UVC control data */
0013 #define UVC_CTRL_DATA_TYPE_RAW      0
0014 #define UVC_CTRL_DATA_TYPE_SIGNED   1
0015 #define UVC_CTRL_DATA_TYPE_UNSIGNED 2
0016 #define UVC_CTRL_DATA_TYPE_BOOLEAN  3
0017 #define UVC_CTRL_DATA_TYPE_ENUM     4
0018 #define UVC_CTRL_DATA_TYPE_BITMASK  5
0019 
0020 /* Control flags */
0021 #define UVC_CTRL_FLAG_SET_CUR       (1 << 0)
0022 #define UVC_CTRL_FLAG_GET_CUR       (1 << 1)
0023 #define UVC_CTRL_FLAG_GET_MIN       (1 << 2)
0024 #define UVC_CTRL_FLAG_GET_MAX       (1 << 3)
0025 #define UVC_CTRL_FLAG_GET_RES       (1 << 4)
0026 #define UVC_CTRL_FLAG_GET_DEF       (1 << 5)
0027 /* Control should be saved at suspend and restored at resume. */
0028 #define UVC_CTRL_FLAG_RESTORE       (1 << 6)
0029 /* Control can be updated by the camera. */
0030 #define UVC_CTRL_FLAG_AUTO_UPDATE   (1 << 7)
0031 /* Control supports asynchronous reporting */
0032 #define UVC_CTRL_FLAG_ASYNCHRONOUS  (1 << 8)
0033 
0034 #define UVC_CTRL_FLAG_GET_RANGE \
0035     (UVC_CTRL_FLAG_GET_CUR | UVC_CTRL_FLAG_GET_MIN | \
0036      UVC_CTRL_FLAG_GET_MAX | UVC_CTRL_FLAG_GET_RES | \
0037      UVC_CTRL_FLAG_GET_DEF)
0038 
0039 struct uvc_menu_info {
0040     __u32 value;
0041     __u8 name[32];
0042 };
0043 
0044 struct uvc_xu_control_mapping {
0045     __u32 id;
0046     __u8 name[32];
0047     __u8 entity[16];
0048     __u8 selector;
0049 
0050     __u8 size;
0051     __u8 offset;
0052     __u32 v4l2_type;
0053     __u32 data_type;
0054 
0055     struct uvc_menu_info __user *menu_info;
0056     __u32 menu_count;
0057 
0058     __u32 reserved[4];
0059 };
0060 
0061 struct uvc_xu_control_query {
0062     __u8 unit;
0063     __u8 selector;
0064     __u8 query;     /* Video Class-Specific Request Code, */
0065                 /* defined in linux/usb/video.h A.8.  */
0066     __u16 size;
0067     __u8 __user *data;
0068 };
0069 
0070 #define UVCIOC_CTRL_MAP     _IOWR('u', 0x20, struct uvc_xu_control_mapping)
0071 #define UVCIOC_CTRL_QUERY   _IOWR('u', 0x21, struct uvc_xu_control_query)
0072 
0073 /*
0074  * Metadata node
0075  */
0076 
0077 /**
0078  * struct uvc_meta_buf - metadata buffer building block
0079  * @ns: system timestamp of the payload in nanoseconds
0080  * @sof: USB Frame Number
0081  * @length: length of the payload header
0082  * @flags: payload header flags
0083  * @buf: optional device-specific header data
0084  *
0085  * UVC metadata nodes fill buffers with possibly multiple instances of this
0086  * struct. The first two fields are added by the driver, they can be used for
0087  * clock synchronisation. The rest is an exact copy of a UVC payload header.
0088  * Only complete objects with complete buffers are included. Therefore it's
0089  * always sizeof(meta->ts) + sizeof(meta->sof) + meta->length bytes large.
0090  */
0091 struct uvc_meta_buf {
0092     __u64 ns;
0093     __u16 sof;
0094     __u8 length;
0095     __u8 flags;
0096     __u8 buf[];
0097 } __packed;
0098 
0099 #endif