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