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