xref: /freebsd/sys/compat/linux/linux_videodev2_compat.h (revision 02e9120893770924227138ba49df1edb3896112a)
1 /*
2  * This file defines compatibility versions of several video structures
3  * defined in the Linux videodev2.h header (linux_videodev2.h).  The
4  * structures defined in this file are the ones that have been determined
5  * to have 32- to 64-bit size dependencies.
6  */
7 
8 #ifndef _LINUX_VIDEODEV2_COMPAT_H_
9 #define	_LINUX_VIDEODEV2_COMPAT_H_
10 
11 struct l_v4l2_buffer {
12 	uint32_t		index;
13 	enum v4l2_buf_type	type;
14 	uint32_t		bytesused;
15 	uint32_t		flags;
16 	enum v4l2_field		field;
17 	l_timeval		timestamp;
18 	struct v4l2_timecode	timecode;
19 	uint32_t		sequence;
20 
21 	/* memory location */
22 	enum v4l2_memory	memory;
23 	union {
24 		uint32_t	offset;
25 		l_ulong		userptr;
26 	} m;
27 	uint32_t		length;
28 	uint32_t		input;
29 	uint32_t		reserved;
30 };
31 
32 struct l_v4l2_framebuffer {
33 	uint32_t		capability;
34 	uint32_t		flags;
35 /* FIXME: in theory we should pass something like PCI device + memory
36  * region + offset instead of some physical address */
37 	l_uintptr_t		base;
38 	struct v4l2_pix_format	fmt;
39 };
40 
41 struct l_v4l2_clip {
42 	struct v4l2_rect	c;
43 	l_uintptr_t		next;
44 };
45 
46 struct l_v4l2_window {
47 	struct v4l2_rect	w;
48 	enum v4l2_field		field;
49 	uint32_t		chromakey;
50 	l_uintptr_t		clips;
51 	uint32_t		clipcount;
52 	l_uintptr_t		bitmap;
53 	uint8_t			global_alpha;
54 };
55 
56 struct l_v4l2_standard {
57 	uint32_t		index;
58 	v4l2_std_id		id;
59 	uint8_t			name[24];
60 	struct v4l2_fract	frameperiod; /* Frames, not fields */
61 	uint32_t		framelines;
62 	uint32_t		reserved[4];
63 }
64 #ifdef COMPAT_LINUX32 /* 32bit linuxolator */
65 __attribute__ ((packed))
66 #endif
67 ;
68 
69 struct l_v4l2_ext_control {
70 	uint32_t id;
71 	uint32_t size;
72 	uint32_t reserved2[1];
73 	union {
74 		int32_t value;
75 		int64_t value64;
76 		l_uintptr_t string;
77 	} u;
78 } __attribute__ ((packed));
79 
80 struct l_v4l2_ext_controls {
81 	uint32_t ctrl_class;
82 	uint32_t count;
83 	uint32_t error_idx;
84 	uint32_t reserved[2];
85 	l_uintptr_t controls;
86 };
87 
88 struct l_v4l2_format {
89 	enum v4l2_buf_type type;
90 	union {
91 		struct v4l2_pix_format		pix;     /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
92 		struct l_v4l2_window		win;     /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
93 		struct v4l2_vbi_format		vbi;     /* V4L2_BUF_TYPE_VBI_CAPTURE */
94 		struct v4l2_sliced_vbi_format	sliced;  /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
95 		uint8_t	raw_data[200];                   /* user-defined */
96 	} fmt;
97 }
98 #ifdef COMPAT_LINUX32 /* 32bit linuxolator */
99 __attribute__ ((packed))
100 #endif
101 ;
102 
103 #ifdef VIDIOC_DQEVENT
104 struct l_v4l2_event {
105 	uint32_t				type;
106 	union {
107 		struct v4l2_event_vsync vsync;
108 		uint8_t			data[64];
109 	} u;
110 	uint32_t				pending;
111 	uint32_t				sequence;
112 	struct l_timespec			timestamp;
113 	uint32_t				reserved[9];
114 };
115 #endif
116 
117 struct l_v4l2_input {
118 	uint32_t	     index;		/*  Which input */
119 	uint8_t		     name[32];		/*  Label */
120 	uint32_t	     type;		/*  Type of input */
121 	uint32_t	     audioset;		/*  Associated audios (bitfield) */
122 	uint32_t	     tuner;             /*  Associated tuner */
123 	v4l2_std_id  std;
124 	uint32_t	     status;
125 	uint32_t	     capabilities;
126 	uint32_t	     reserved[3];
127 }
128 #ifdef COMPAT_LINUX32 /* 32bit linuxolator */
129 __attribute__ ((packed))
130 #endif
131 ;
132 
133 #endif /* _LINUX_VIDEODEV2_COMPAT_H_ */
134