1221434Snetchild/*
2221434Snetchild * $FreeBSD$
3221434Snetchild */
4221434Snetchild
5221434Snetchild/*
6221434Snetchild * This file defines compatibility versions of several video structures
7221434Snetchild * defined in the Linux videodev2.h header (linux_videodev2.h).  The
8221434Snetchild * structures defined in this file are the ones that have been determined
9221434Snetchild * to have 32- to 64-bit size dependencies.
10221434Snetchild */
11221434Snetchild
12221434Snetchild#ifndef _LINUX_VIDEODEV2_COMPAT_H_
13221434Snetchild#define	_LINUX_VIDEODEV2_COMPAT_H_
14221434Snetchild
15221434Snetchildstruct l_v4l2_buffer {
16221434Snetchild	uint32_t		index;
17221434Snetchild	enum v4l2_buf_type	type;
18221434Snetchild	uint32_t		bytesused;
19221434Snetchild	uint32_t		flags;
20221434Snetchild	enum v4l2_field		field;
21221434Snetchild	l_timeval		timestamp;
22221434Snetchild	struct v4l2_timecode	timecode;
23221434Snetchild	uint32_t		sequence;
24221434Snetchild
25221434Snetchild	/* memory location */
26221434Snetchild	enum v4l2_memory	memory;
27221434Snetchild	union {
28221434Snetchild		uint32_t	offset;
29221434Snetchild		l_ulong		userptr;
30221434Snetchild	} m;
31221434Snetchild	uint32_t		length;
32221434Snetchild	uint32_t		input;
33221434Snetchild	uint32_t		reserved;
34221434Snetchild};
35221434Snetchild
36221434Snetchildstruct l_v4l2_framebuffer {
37221434Snetchild	uint32_t		capability;
38221434Snetchild	uint32_t		flags;
39221434Snetchild/* FIXME: in theory we should pass something like PCI device + memory
40221434Snetchild * region + offset instead of some physical address */
41221434Snetchild	l_uintptr_t		base;
42221434Snetchild	struct v4l2_pix_format	fmt;
43221434Snetchild};
44221434Snetchild
45221434Snetchildstruct l_v4l2_clip {
46221434Snetchild	struct v4l2_rect	c;
47221434Snetchild	l_uintptr_t		next;
48221434Snetchild};
49221434Snetchild
50221434Snetchildstruct l_v4l2_window {
51221434Snetchild	struct v4l2_rect	w;
52221434Snetchild	enum v4l2_field		field;
53221434Snetchild	uint32_t		chromakey;
54221434Snetchild	l_uintptr_t		clips;
55221434Snetchild	uint32_t		clipcount;
56221434Snetchild	l_uintptr_t		bitmap;
57221434Snetchild	uint8_t			global_alpha;
58221434Snetchild};
59221434Snetchild
60221434Snetchildstruct l_v4l2_standard {
61221434Snetchild	uint32_t		index;
62221434Snetchild	v4l2_std_id		id;
63221434Snetchild	uint8_t			name[24];
64221434Snetchild	struct v4l2_fract	frameperiod; /* Frames, not fields */
65221434Snetchild	uint32_t		framelines;
66221434Snetchild	uint32_t		reserved[4];
67221434Snetchild}
68221434Snetchild#ifdef COMPAT_LINUX32 /* 32bit linuxolator */
69221434Snetchild__attribute__ ((packed))
70221434Snetchild#endif
71221434Snetchild;
72221434Snetchild
73221434Snetchildstruct l_v4l2_ext_control {
74221434Snetchild	uint32_t id;
75221434Snetchild	uint32_t size;
76221434Snetchild	uint32_t reserved2[1];
77221434Snetchild	union {
78221434Snetchild		int32_t value;
79221434Snetchild		int64_t value64;
80221434Snetchild		l_uintptr_t string;
81221434Snetchild	} u;
82221434Snetchild} __attribute__ ((packed));
83221434Snetchild
84221434Snetchildstruct l_v4l2_ext_controls {
85221434Snetchild	uint32_t ctrl_class;
86221434Snetchild	uint32_t count;
87221434Snetchild	uint32_t error_idx;
88221434Snetchild	uint32_t reserved[2];
89221434Snetchild	l_uintptr_t controls;
90221434Snetchild};
91221434Snetchild
92221434Snetchildstruct l_v4l2_format {
93221434Snetchild	enum v4l2_buf_type type;
94221434Snetchild	union {
95221434Snetchild		struct v4l2_pix_format		pix;     /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
96221434Snetchild		struct l_v4l2_window		win;     /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
97221434Snetchild		struct v4l2_vbi_format		vbi;     /* V4L2_BUF_TYPE_VBI_CAPTURE */
98221434Snetchild		struct v4l2_sliced_vbi_format	sliced;  /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
99221434Snetchild		uint8_t	raw_data[200];                   /* user-defined */
100221434Snetchild	} fmt;
101221434Snetchild}
102221434Snetchild#ifdef COMPAT_LINUX32 /* 32bit linuxolator */
103221434Snetchild__attribute__ ((packed))
104221434Snetchild#endif
105221434Snetchild;
106221434Snetchild
107221434Snetchild#ifdef VIDIOC_DQEVENT
108221434Snetchildstruct l_v4l2_event {
109221434Snetchild	uint32_t				type;
110221434Snetchild	union {
111221434Snetchild		struct v4l2_event_vsync vsync;
112221434Snetchild		uint8_t			data[64];
113221434Snetchild	} u;
114221434Snetchild	uint32_t				pending;
115221434Snetchild	uint32_t				sequence;
116221434Snetchild	struct l_timespec			timestamp;
117221434Snetchild	uint32_t				reserved[9];
118221434Snetchild};
119221434Snetchild#endif
120221434Snetchild
121221434Snetchildstruct l_v4l2_input {
122221434Snetchild	uint32_t	     index;		/*  Which input */
123221434Snetchild	uint8_t		     name[32];		/*  Label */
124221434Snetchild	uint32_t	     type;		/*  Type of input */
125221434Snetchild	uint32_t	     audioset;		/*  Associated audios (bitfield) */
126221434Snetchild	uint32_t	     tuner;             /*  Associated tuner */
127221434Snetchild	v4l2_std_id  std;
128221434Snetchild	uint32_t	     status;
129221434Snetchild	uint32_t	     capabilities;
130221434Snetchild	uint32_t	     reserved[3];
131221434Snetchild}
132221434Snetchild#ifdef COMPAT_LINUX32 /* 32bit linuxolator */
133221434Snetchild__attribute__ ((packed))
134221434Snetchild#endif
135221434Snetchild;
136221434Snetchild
137221434Snetchild#endif /* _LINUX_VIDEODEV2_COMPAT_H_ */
138