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