xref: /openbsd-src/sys/dev/ic/bt8xx.h (revision 8defa1362ad63970c9033e7886cd9f3841feea68)
1*8defa136Srobert /*	$OpenBSD: bt8xx.h,v 1.3 2005/06/23 14:57:48 robert Exp $	*/
2b20e9dccSfgsch /*	$NetBSD: bt8xx.h,v 1.4 2000/12/30 16:55:24 wiz Exp $	*/
3b20e9dccSfgsch 
4b20e9dccSfgsch /* This file is merged from ioctl_meteor.h and ioctl_bt848.h from FreeBSD. */
5b20e9dccSfgsch /* The copyright below only applies to the ioctl_meteor.h part of this file. */
6b20e9dccSfgsch 
7b20e9dccSfgsch #ifndef _DEV_IC_BT8XX_H_
8b20e9dccSfgsch #define _DEV_IC_BT8XX_H_
9b20e9dccSfgsch /*
10b20e9dccSfgsch  * Copyright (c) 1995 Mark Tinguely and Jim Lowe
11b20e9dccSfgsch  * All rights reserved.
12b20e9dccSfgsch  *
13b20e9dccSfgsch  * Redistribution and use in source and binary forms, with or without
14b20e9dccSfgsch  * modification, are permitted provided that the following conditions
15b20e9dccSfgsch  * are met:
16b20e9dccSfgsch  * 1. Redistributions of source code must retain the above copyright
17b20e9dccSfgsch  *    notice, this list of conditions and the following disclaimer.
18b20e9dccSfgsch  * 2. Redistributions in binary form must reproduce the above copyright
19b20e9dccSfgsch  *    notice, this list of conditions and the following disclaimer in the
20b20e9dccSfgsch  *    documentation and/or other materials provided with the distribution.
21b20e9dccSfgsch  * 3. All advertising materials mentioning features or use of this software
22b20e9dccSfgsch  *    must display the following acknowledgement:
23b20e9dccSfgsch  *	This product includes software developed by Mark Tinguely and Jim Lowe
24b20e9dccSfgsch  * 4. The name of the author may not be used to endorse or promote products
25b20e9dccSfgsch  *    derived from this software without specific prior written permission.
26b20e9dccSfgsch  *
27b20e9dccSfgsch  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
28b20e9dccSfgsch  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
29b20e9dccSfgsch  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
30b20e9dccSfgsch  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
31b20e9dccSfgsch  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
32b20e9dccSfgsch  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
33b20e9dccSfgsch  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34b20e9dccSfgsch  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
35b20e9dccSfgsch  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
36b20e9dccSfgsch  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37b20e9dccSfgsch  * POSSIBILITY OF SUCH DAMAGE.
38b20e9dccSfgsch  *
39b20e9dccSfgsch  * FreeBSD: src/sys/i386/include/ioctl_meteor.h,v 1.11 1999/12/29 04:33:02 peter Exp
40b20e9dccSfgsch  */
41b20e9dccSfgsch /*
42b20e9dccSfgsch  *	ioctl constants for Matrox Meteor Capture card.
43b20e9dccSfgsch  */
44b20e9dccSfgsch 
45b20e9dccSfgsch 
46b20e9dccSfgsch #ifndef _KERNEL
47b20e9dccSfgsch #include <sys/types.h>
48b20e9dccSfgsch #endif
49b20e9dccSfgsch #include <sys/ioccom.h>
50b20e9dccSfgsch 
51b20e9dccSfgsch struct meteor_capframe {
52b20e9dccSfgsch 	short	command;	/* see below for valid METEORCAPFRM commands */
53b20e9dccSfgsch 	short	lowat;		/* start transfer if < this number */
54b20e9dccSfgsch 	short	hiwat;		/* stop transfer if > this number */
55b20e9dccSfgsch } ;
56b20e9dccSfgsch 
57b20e9dccSfgsch /* structure for METEOR[GS]ETGEO - get/set geometry  */
58b20e9dccSfgsch struct meteor_geomet {
59b20e9dccSfgsch 	u_short		rows;
60b20e9dccSfgsch 	u_short		columns;
61b20e9dccSfgsch 	u_short		frames;
62*8defa136Srobert 	u_int		oformat;
63b20e9dccSfgsch } ;
64b20e9dccSfgsch 
65b20e9dccSfgsch /* structure for METEORGCOUNT-get count of frames, fifo errors and dma errors */
66b20e9dccSfgsch struct meteor_counts {
67*8defa136Srobert 	u_int fifo_errors;	/* count of fifo errors since open */
68*8defa136Srobert 	u_int dma_errors;	/* count of dma errors since open */
69*8defa136Srobert 	u_int frames_captured;	/* count of frames captured since open */
70*8defa136Srobert 	u_int even_fields_captured; /* count of even fields captured */
71*8defa136Srobert 	u_int odd_fields_captured; /* count of odd fields captured */
72b20e9dccSfgsch } ;
73b20e9dccSfgsch 
74b20e9dccSfgsch /* structure for getting and setting direct transfers to vram */
75b20e9dccSfgsch struct meteor_video {
76*8defa136Srobert 	u_int	addr;	/* Address of location to dma to */
77*8defa136Srobert 	u_int	width;	/* Width of memory area */
78*8defa136Srobert 	u_int	banksize;	/* Size of Vram bank */
79*8defa136Srobert 	u_int	ramsize;	/* Size of Vram */
80b20e9dccSfgsch };
81b20e9dccSfgsch 
82b20e9dccSfgsch #define METEORCAPTUR _IOW('x', 1, int)			 /* capture a frame */
83b20e9dccSfgsch #define METEORCAPFRM _IOW('x', 2, struct meteor_capframe)  /* sync capture */
84b20e9dccSfgsch #define METEORSETGEO _IOW('x', 3, struct meteor_geomet)  /* set geometry */
85b20e9dccSfgsch #define METEORGETGEO _IOR('x', 4, struct meteor_geomet)  /* get geometry */
86b20e9dccSfgsch #define METEORSTATUS _IOR('x', 5, unsigned short)	/* get status */
87b20e9dccSfgsch #define METEORSHUE   _IOW('x', 6, signed char)		/* set hue */
88b20e9dccSfgsch #define METEORGHUE   _IOR('x', 6, signed char)		/* get hue */
89*8defa136Srobert #define METEORSFMT   _IOW('x', 7, unsigned int)		/* set format */
90*8defa136Srobert #define METEORGFMT   _IOR('x', 7, unsigned int)		/* get format */
91*8defa136Srobert #define METEORSINPUT _IOW('x', 8, unsigned int)		/* set input dev */
92*8defa136Srobert #define METEORGINPUT _IOR('x', 8, unsigned int)		/* get input dev */
93b20e9dccSfgsch #define	METEORSCHCV  _IOW('x', 9, unsigned char)	/* set uv gain */
94b20e9dccSfgsch #define	METEORGCHCV  _IOR('x', 9, unsigned char)	/* get uv gain */
95b20e9dccSfgsch #define	METEORSCOUNT _IOW('x',10, struct meteor_counts)
96b20e9dccSfgsch #define	METEORGCOUNT _IOR('x',10, struct meteor_counts)
97b20e9dccSfgsch #define METEORSFPS   _IOW('x',11, unsigned short)	/* set fps */
98b20e9dccSfgsch #define METEORGFPS   _IOR('x',11, unsigned short)	/* get fps */
99b20e9dccSfgsch #define METEORSSIGNAL _IOW('x', 12, unsigned int)	/* set signal */
100b20e9dccSfgsch #define METEORGSIGNAL _IOR('x', 12, unsigned int)	/* get signal */
101b20e9dccSfgsch #define	METEORSVIDEO _IOW('x', 13, struct meteor_video)	/* set video */
102b20e9dccSfgsch #define	METEORGVIDEO _IOR('x', 13, struct meteor_video)	/* get video */
103b20e9dccSfgsch #define	METEORSBRIG  _IOW('x', 14, unsigned char)	/* set brightness */
104b20e9dccSfgsch #define METEORGBRIG  _IOR('x', 14, unsigned char)	/* get brightness */
105b20e9dccSfgsch #define	METEORSCSAT  _IOW('x', 15, unsigned char)	/* set chroma sat */
106b20e9dccSfgsch #define METEORGCSAT  _IOR('x', 15, unsigned char)	/* get uv saturation */
107b20e9dccSfgsch #define	METEORSCONT  _IOW('x', 16, unsigned char)	/* set contrast */
108b20e9dccSfgsch #define	METEORGCONT  _IOR('x', 16, unsigned char)	/* get contrast */
109b20e9dccSfgsch #define METEORSBT254 _IOW('x', 17, unsigned short)	/* set Bt254 reg */
110b20e9dccSfgsch #define METEORGBT254 _IOR('x', 17, unsigned short)	/* get Bt254 reg */
111b20e9dccSfgsch #define METEORSHWS   _IOW('x', 18, unsigned char)	/* set hor start reg */
112b20e9dccSfgsch #define METEORGHWS   _IOR('x', 18, unsigned char)	/* get hor start reg */
113b20e9dccSfgsch #define METEORSVWS   _IOW('x', 19, unsigned char)	/* set vert start reg */
114b20e9dccSfgsch #define METEORGVWS   _IOR('x', 19, unsigned char)	/* get vert start reg */
115b20e9dccSfgsch #define	METEORSTS    _IOW('x', 20, unsigned char)	/* set time stamp */
116b20e9dccSfgsch #define	METEORGTS    _IOR('x', 20, unsigned char)	/* get time stamp */
117b20e9dccSfgsch 
118b20e9dccSfgsch #define	METEOR_STATUS_ID_MASK	0xf000	/* ID of 7196 */
119b20e9dccSfgsch #define	METEOR_STATUS_DIR	0x0800	/* Direction of Expansion port YUV */
120b20e9dccSfgsch #define	METEOR_STATUS_OEF	0x0200	/* Field detected: Even/Odd */
121b20e9dccSfgsch #define	METEOR_STATUS_SVP	0x0100	/* State of VRAM Port:inactive/active */
122b20e9dccSfgsch #define	METEOR_STATUS_STTC	0x0080	/* Time Constant: TV/VCR */
123b20e9dccSfgsch #define	METEOR_STATUS_HCLK	0x0040	/* Horiz PLL: locked/unlocked */
124b20e9dccSfgsch #define	METEOR_STATUS_FIDT	0x0020	/* Field detect: 50/60hz */
125b20e9dccSfgsch #define	METEOR_STATUS_ALTD	0x0002	/* Line alt: no line alt/line alt */
126b20e9dccSfgsch #define METEOR_STATUS_CODE	0x0001	/* Colour info: no colour/colour */
127b20e9dccSfgsch 
128b20e9dccSfgsch 				/* METEORCAPTUR capture options */
129b20e9dccSfgsch #define METEOR_CAP_SINGLE	0x0001	/* capture one frame */
130b20e9dccSfgsch #define METEOR_CAP_CONTINOUS	0x0002	/* continuously capture */
131b20e9dccSfgsch #define METEOR_CAP_STOP_CONT	0x0004	/* stop the continuous capture */
132b20e9dccSfgsch 
133b20e9dccSfgsch 				/* METEORCAPFRM capture commands */
134b20e9dccSfgsch #define METEOR_CAP_N_FRAMES	0x0001	/* capture N frames */
135b20e9dccSfgsch #define METEOR_CAP_STOP_FRAMES	0x0002	/* stop capture N frames */
136b20e9dccSfgsch #define	METEOR_HALT_N_FRAMES	0x0003	/* halt of capture N frames */
137b20e9dccSfgsch #define METEOR_CONT_N_FRAMES	0x0004	/* continue after above halt */
138b20e9dccSfgsch 
139b20e9dccSfgsch 				/* valid video input formats:  */
140b20e9dccSfgsch #define METEOR_FMT_NTSC		0x00100	/* NTSC --  initialized default */
141b20e9dccSfgsch #define METEOR_FMT_PAL		0x00200	/* PAL */
142b20e9dccSfgsch #define METEOR_FMT_SECAM	0x00400	/* SECAM */
143b20e9dccSfgsch #define METEOR_FMT_AUTOMODE	0x00800 /* auto-mode */
144b20e9dccSfgsch #define METEOR_INPUT_DEV0	0x01000	/* camera input 0 -- default */
145b20e9dccSfgsch #define METEOR_INPUT_DEV_RCA	METEOR_INPUT_DEV0
146b20e9dccSfgsch #define METEOR_INPUT_DEV1	0x02000	/* camera input 1 */
147b20e9dccSfgsch #define METEOR_INPUT_DEV2	0x04000	/* camera input 2 */
148b20e9dccSfgsch #define METEOR_INPUT_DEV3	0x08000	/* camera input 3 */
149b20e9dccSfgsch #define METEOR_INPUT_DEV_RGB	0x0a000	/* for rgb version of meteor */
150b20e9dccSfgsch #define METEOR_INPUT_DEV_SVIDEO	0x06000 /* S-video input port */
151b20e9dccSfgsch 
152b20e9dccSfgsch 				/* valid video output formats:  */
153b20e9dccSfgsch #define METEOR_GEO_RGB16	0x0010000 /* packed -- initialized default */
154b20e9dccSfgsch #define METEOR_GEO_RGB24	0x0020000 /* RBG 24 bits packed */
155b20e9dccSfgsch 					  /* internally stored in 32 bits */
156b20e9dccSfgsch #define METEOR_GEO_YUV_PACKED	0x0040000 /* 4-2-2 YUV 16 bits packed */
157b20e9dccSfgsch #define METEOR_GEO_YUV_PLANAR	0x0080000 /* 4-2-2 YUV 16 bits planer */
158b20e9dccSfgsch #define METEOR_GEO_YUV_PLANER	METEOR_GEO_YUV_PLANAR
159b20e9dccSfgsch #define METEOR_GEO_UNSIGNED	0x0400000 /* unsigned uv outputs */
160b20e9dccSfgsch #define METEOR_GEO_EVEN_ONLY	0x1000000 /* set for even only field capture */
161b20e9dccSfgsch #define METEOR_GEO_ODD_ONLY	0x2000000 /* set for odd only field capture */
162b20e9dccSfgsch #define METEOR_GEO_FIELD_MASK	0x3000000
163b20e9dccSfgsch #define METEOR_GEO_YUV_422	0x4000000 /* 4-2-2 YUV in Y-U-V combined */
164b20e9dccSfgsch #define METEOR_GEO_OUTPUT_MASK	0x40f0000
165b20e9dccSfgsch #define METEOR_GEO_YUV_12	0x10000000	/* YUV 12 format */
166b20e9dccSfgsch #define METEOR_GEO_YUV_9	0x40000000	/* YUV 9 format */
167b20e9dccSfgsch 
168b20e9dccSfgsch #define	METEOR_FIELD_MODE	0x80000000	/* Field cap or Frame cap */
169b20e9dccSfgsch 
170b20e9dccSfgsch #define	METEOR_SIG_MODE_MASK	0xffff0000
171b20e9dccSfgsch #define	METEOR_SIG_FRAME	0x00000000	/* signal every frame */
172b20e9dccSfgsch #define	METEOR_SIG_FIELD	0x00010000	/* signal every field */
173b20e9dccSfgsch 
174b20e9dccSfgsch 	/* following structure is used to coordinate the synchronous */
175b20e9dccSfgsch 
176b20e9dccSfgsch struct meteor_mem {
177b20e9dccSfgsch 		/* kernel write only  */
178b20e9dccSfgsch 	int	frame_size;	 /* row*columns*depth */
179b20e9dccSfgsch 	unsigned num_bufs;	 /* number of frames in buffer (1-32) */
180b20e9dccSfgsch 		/* user and kernel change these */
181b20e9dccSfgsch 	int	lowat;		 /* kernel starts capture if < this number */
182b20e9dccSfgsch 	int	hiwat;		 /* kernel stops capture if > this number.
183b20e9dccSfgsch 				    hiwat <= numbufs */
184b20e9dccSfgsch 	unsigned active;	 /* bit mask of active frame buffers
185b20e9dccSfgsch 				    kernel sets, user clears */
186b20e9dccSfgsch 	int	num_active_bufs; /* count of active frame buffer
187b20e9dccSfgsch 				    kernel increments, user decrements */
188b20e9dccSfgsch 
189b20e9dccSfgsch 		/* reference to mmapped data */
190b20e9dccSfgsch 	caddr_t	buf;		 /* The real space (virtual addr) */
191b20e9dccSfgsch } ;
192b20e9dccSfgsch 
193b20e9dccSfgsch /*
194b20e9dccSfgsch  * extensions to ioctl_meteor.h for the bt848 cards
195b20e9dccSfgsch  *
196b20e9dccSfgsch  * FreeBSD: src/sys/i386/include/ioctl_bt848.h,v 1.27 2000/10/26 16:41:48 roger Exp
197b20e9dccSfgsch  */
198b20e9dccSfgsch 
199b20e9dccSfgsch 
200b20e9dccSfgsch /*
201b20e9dccSfgsch  * frequency sets
202b20e9dccSfgsch  */
203b20e9dccSfgsch #define CHNLSET_NABCST		1
204b20e9dccSfgsch #define CHNLSET_CABLEIRC	2
205b20e9dccSfgsch #define CHNLSET_CABLEHRC	3
206b20e9dccSfgsch #define CHNLSET_WEUROPE		4
207b20e9dccSfgsch #define CHNLSET_JPNBCST         5
208b20e9dccSfgsch #define CHNLSET_JPNCABLE        6
209b20e9dccSfgsch #define CHNLSET_XUSSR           7
210b20e9dccSfgsch #define CHNLSET_AUSTRALIA       8
211b20e9dccSfgsch #define CHNLSET_FRANCE          9
212b20e9dccSfgsch #define CHNLSET_MIN	        CHNLSET_NABCST
213b20e9dccSfgsch #define CHNLSET_MAX	        CHNLSET_FRANCE
214b20e9dccSfgsch 
215b20e9dccSfgsch 
216b20e9dccSfgsch /*
217b20e9dccSfgsch  * constants for various tuner registers
218b20e9dccSfgsch  */
219b20e9dccSfgsch #define BT848_HUEMIN		(-90)
220b20e9dccSfgsch #define BT848_HUEMAX		90
221b20e9dccSfgsch #define BT848_HUECENTER		0
222b20e9dccSfgsch #define BT848_HUERANGE		179.3
223b20e9dccSfgsch #define BT848_HUEREGMIN		(-128)
224b20e9dccSfgsch #define BT848_HUEREGMAX		127
225b20e9dccSfgsch #define BT848_HUESTEPS		256
226b20e9dccSfgsch 
227b20e9dccSfgsch #define BT848_BRIGHTMIN		(-50)
228b20e9dccSfgsch #define BT848_BRIGHTMAX		50
229b20e9dccSfgsch #define BT848_BRIGHTCENTER	0
230b20e9dccSfgsch #define BT848_BRIGHTRANGE	99.6
231b20e9dccSfgsch #define BT848_BRIGHTREGMIN	(-128)
232b20e9dccSfgsch #define BT848_BRIGHTREGMAX	127
233b20e9dccSfgsch #define BT848_BRIGHTSTEPS	256
234b20e9dccSfgsch 
235b20e9dccSfgsch #define BT848_CONTRASTMIN	0
236b20e9dccSfgsch #define BT848_CONTRASTMAX	237
237b20e9dccSfgsch #define BT848_CONTRASTCENTER	100
238b20e9dccSfgsch #define BT848_CONTRASTRANGE	236.57
239b20e9dccSfgsch #define BT848_CONTRASTREGMIN	0
240b20e9dccSfgsch #define BT848_CONTRASTREGMAX	511
241b20e9dccSfgsch #define BT848_CONTRASTSTEPS	512
242b20e9dccSfgsch 
243b20e9dccSfgsch #define BT848_CHROMAMIN		0
244b20e9dccSfgsch #define BT848_CHROMAMAX		284
245b20e9dccSfgsch #define BT848_CHROMACENTER	100
246b20e9dccSfgsch #define BT848_CHROMARANGE	283.89
247b20e9dccSfgsch #define BT848_CHROMAREGMIN	0
248b20e9dccSfgsch #define BT848_CHROMAREGMAX	511
249b20e9dccSfgsch #define BT848_CHROMASTEPS	512
250b20e9dccSfgsch 
251b20e9dccSfgsch #define BT848_SATUMIN		0
252b20e9dccSfgsch #define BT848_SATUMAX		202
253b20e9dccSfgsch #define BT848_SATUCENTER	100
254b20e9dccSfgsch #define BT848_SATURANGE		201.18
255b20e9dccSfgsch #define BT848_SATUREGMIN	0
256b20e9dccSfgsch #define BT848_SATUREGMAX	511
257b20e9dccSfgsch #define BT848_SATUSTEPS		512
258b20e9dccSfgsch 
259b20e9dccSfgsch #define BT848_SATVMIN		0
260b20e9dccSfgsch #define BT848_SATVMAX		284
261b20e9dccSfgsch #define BT848_SATVCENTER	100
262b20e9dccSfgsch #define BT848_SATVRANGE		283.89
263b20e9dccSfgsch #define BT848_SATVREGMIN	0
264b20e9dccSfgsch #define BT848_SATVREGMAX	511
265b20e9dccSfgsch #define BT848_SATVSTEPS		512
266b20e9dccSfgsch 
267b20e9dccSfgsch 
268b20e9dccSfgsch /*
269b20e9dccSfgsch  * audio stuff
270b20e9dccSfgsch  */
271b20e9dccSfgsch #define AUDIO_TUNER		0x00	/* command for the audio routine */
272b20e9dccSfgsch #define AUDIO_EXTERN		0x01	/* don't confuse them with bit */
273b20e9dccSfgsch #define AUDIO_INTERN		0x02	/* settings */
274b20e9dccSfgsch #define AUDIO_MUTE		0x80
275b20e9dccSfgsch #define AUDIO_UNMUTE		0x81
276b20e9dccSfgsch 
277b20e9dccSfgsch 
278b20e9dccSfgsch /*
279b20e9dccSfgsch  * EEProm stuff
280b20e9dccSfgsch  */
281b20e9dccSfgsch struct eeProm {
282b20e9dccSfgsch 	short	offset;
283b20e9dccSfgsch 	short	count;
284b20e9dccSfgsch 	u_char	bytes[ 256 ];
285b20e9dccSfgsch };
286b20e9dccSfgsch 
287b20e9dccSfgsch 
288b20e9dccSfgsch /*
289b20e9dccSfgsch  * XXX: this is a hack, should be in ioctl_meteor.h
290b20e9dccSfgsch  * here to avoid touching that file for now...
291b20e9dccSfgsch  */
292b20e9dccSfgsch #define	TVTUNER_SETCHNL    _IOW('x', 32, unsigned int)	/* set channel */
293b20e9dccSfgsch #define	TVTUNER_GETCHNL    _IOR('x', 32, unsigned int)	/* get channel */
294b20e9dccSfgsch #define	TVTUNER_SETTYPE    _IOW('x', 33, unsigned int)	/* set tuner type */
295b20e9dccSfgsch #define	TVTUNER_GETTYPE    _IOR('x', 33, unsigned int)	/* get tuner type */
296b20e9dccSfgsch #define	TVTUNER_GETSTATUS  _IOR('x', 34, unsigned int)	/* get tuner status */
297b20e9dccSfgsch #define	TVTUNER_SETFREQ    _IOW('x', 35, unsigned int)	/* set frequency */
298b20e9dccSfgsch #define	TVTUNER_GETFREQ    _IOR('x', 36, unsigned int)	/* get frequency */
299b20e9dccSfgsch 
300b20e9dccSfgsch 
301b20e9dccSfgsch #define BT848_SHUE	_IOW('x', 37, int)		/* set hue */
302b20e9dccSfgsch #define BT848_GHUE	_IOR('x', 37, int)		/* get hue */
303b20e9dccSfgsch #define	BT848_SBRIG	_IOW('x', 38, int)		/* set brightness */
304b20e9dccSfgsch #define BT848_GBRIG	_IOR('x', 38, int)		/* get brightness */
305b20e9dccSfgsch #define	BT848_SCSAT	_IOW('x', 39, int)		/* set chroma sat */
306b20e9dccSfgsch #define BT848_GCSAT	_IOR('x', 39, int)		/* get UV saturation */
307b20e9dccSfgsch #define	BT848_SCONT	_IOW('x', 40, int)		/* set contrast */
308b20e9dccSfgsch #define	BT848_GCONT	_IOR('x', 40, int)		/* get contrast */
309b20e9dccSfgsch #define	BT848_SVSAT	_IOW('x', 41, int)		/* set chroma V sat */
310b20e9dccSfgsch #define BT848_GVSAT	_IOR('x', 41, int)		/* get V saturation */
311b20e9dccSfgsch #define	BT848_SUSAT	_IOW('x', 42, int)		/* set chroma U sat */
312b20e9dccSfgsch #define BT848_GUSAT	_IOR('x', 42, int)		/* get U saturation */
313b20e9dccSfgsch 
314b20e9dccSfgsch #define	BT848_SCBARS	_IOR('x', 43, int)		/* set colorbar */
315b20e9dccSfgsch #define	BT848_CCBARS	_IOR('x', 44, int)		/* clear colorbar */
316b20e9dccSfgsch 
317b20e9dccSfgsch 
318b20e9dccSfgsch #define	BT848_SAUDIO	_IOW('x', 46, int)		/* set audio channel */
319b20e9dccSfgsch #define BT848_GAUDIO	_IOR('x', 47, int)		/* get audio channel */
320b20e9dccSfgsch #define	BT848_SBTSC	_IOW('x', 48, int)		/* set audio channel */
321b20e9dccSfgsch 
322b20e9dccSfgsch #define	BT848_GSTATUS	_IOR('x', 49, unsigned int)	/* reap status */
323b20e9dccSfgsch 
324b20e9dccSfgsch #define	BT848_WEEPROM	_IOWR('x', 50, struct eeProm)	/* write to EEProm */
325b20e9dccSfgsch #define	BT848_REEPROM	_IOWR('x', 51, struct eeProm)	/* read from EEProm */
326b20e9dccSfgsch 
327b20e9dccSfgsch #define	BT848_SIGNATURE	_IOWR('x', 52, struct eeProm)	/* read card sig */
328b20e9dccSfgsch 
329b20e9dccSfgsch #define	TVTUNER_SETAFC	_IOW('x', 53, int)		/* turn AFC on/off */
330b20e9dccSfgsch #define TVTUNER_GETAFC	_IOR('x', 54, int)		/* query AFC on/off */
331b20e9dccSfgsch #define BT848_SLNOTCH	_IOW('x', 55, int)		/* set luma notch */
332b20e9dccSfgsch #define BT848_GLNOTCH	_IOR('x', 56, int)		/* get luma notch */
333b20e9dccSfgsch 
334b20e9dccSfgsch /* Read/Write the BT848's I2C bus directly
335b20e9dccSfgsch  * b7-b0:    data (read/write)
336b20e9dccSfgsch  * b15-b8:   internal peripheral register (write)
337b20e9dccSfgsch  * b23-b16:  i2c addr (write)
338b20e9dccSfgsch  * b31-b24:  1 = write, 0 = read
339b20e9dccSfgsch  */
340*8defa136Srobert #define BT848_I2CWR     _IOWR('x', 57, u_int)    /* i2c read-write */
341b20e9dccSfgsch 
342b20e9dccSfgsch struct bktr_msp_control {
343b20e9dccSfgsch 	unsigned char function;
344b20e9dccSfgsch 	unsigned int  address;
345b20e9dccSfgsch 	unsigned int  data;
346b20e9dccSfgsch };
347b20e9dccSfgsch 
348b20e9dccSfgsch #define BT848_MSP_RESET _IO('x', 76)				/* MSP chip reset */
349b20e9dccSfgsch #define BT848_MSP_READ  _IOWR('x', 77, struct bktr_msp_control)	/* MSP chip read */
350b20e9dccSfgsch #define BT848_MSP_WRITE _IOWR('x', 78, struct bktr_msp_control)	/* MSP chip write */
351b20e9dccSfgsch 
352b20e9dccSfgsch /* Support for radio tuner */
353b20e9dccSfgsch #define RADIO_SETMODE	 _IOW('x', 58, unsigned int)  /* set radio modes */
354b20e9dccSfgsch #define RADIO_GETMODE	 _IOR('x', 58, unsigned char)  /* get radio modes */
355b20e9dccSfgsch #define   RADIO_AFC	 0x01		/* These modes will probably not */
356b20e9dccSfgsch #define   RADIO_MONO	 0x02		/*  work on the FRxxxx. It does	 */
357b20e9dccSfgsch #define   RADIO_MUTE	 0x08		/*  work on the FMxxxx.	*/
358b20e9dccSfgsch #define RADIO_SETFREQ    _IOW('x', 59, unsigned int)  /* set frequency   */
359b20e9dccSfgsch #define RADIO_GETFREQ    _IOR('x', 59, unsigned int)  /* set frequency   */
360b20e9dccSfgsch  /*        Argument is frequency*100MHz  */
361b20e9dccSfgsch 
362b20e9dccSfgsch /*
363b20e9dccSfgsch  * XXX: more bad magic,
364b20e9dccSfgsch  *      we need to fix the METEORGINPUT to return something public
365b20e9dccSfgsch  *      duplicate them here for now...
366b20e9dccSfgsch  */
367b20e9dccSfgsch #define	METEOR_DEV0		0x00001000
368b20e9dccSfgsch #define	METEOR_DEV1		0x00002000
369b20e9dccSfgsch #define	METEOR_DEV2		0x00004000
370b20e9dccSfgsch #define	METEOR_DEV3		0x00008000
371b20e9dccSfgsch #define	METEOR_DEV_SVIDEO	0x00006000
372b20e9dccSfgsch /*
373b20e9dccSfgsch  * right now I don't know were to put these, but as they are suppose to be
374b20e9dccSfgsch  * a part of a common video capture interface, these should be relocated to
375b20e9dccSfgsch  * another place.  Probably most of the METEOR_xxx defines need to be
376b20e9dccSfgsch  * renamed and moved to a common header
377b20e9dccSfgsch  */
378b20e9dccSfgsch 
379b20e9dccSfgsch typedef enum { METEOR_PIXTYPE_RGB, METEOR_PIXTYPE_YUV,
380b20e9dccSfgsch 	       METEOR_PIXTYPE_YUV_PACKED,
381b20e9dccSfgsch 	       METEOR_PIXTYPE_YUV_12 } METEOR_PIXTYPE;
382b20e9dccSfgsch 
383b20e9dccSfgsch 
384b20e9dccSfgsch struct meteor_pixfmt {
385b20e9dccSfgsch 	u_int          index;         /* Index in supported pixfmt list     */
386b20e9dccSfgsch 	METEOR_PIXTYPE type;          /* What's the board gonna feed us     */
387b20e9dccSfgsch 	u_int          Bpp;           /* Bytes per pixel                    */
388*8defa136Srobert 	u_int          masks[3];      /* R,G,B or Y,U,V masks, respectively */
389b20e9dccSfgsch 	unsigned       swap_bytes :1; /* Bytes  swapped within shorts       */
390b20e9dccSfgsch 	unsigned       swap_shorts:1; /* Shorts swapped within longs        */
391b20e9dccSfgsch };
392b20e9dccSfgsch 
393b20e9dccSfgsch 
394b20e9dccSfgsch struct bktr_clip {
395b20e9dccSfgsch     int          x_min;
396b20e9dccSfgsch     int          x_max;
397b20e9dccSfgsch     int          y_min;
398b20e9dccSfgsch     int          y_max;
399b20e9dccSfgsch };
400b20e9dccSfgsch 
401b20e9dccSfgsch #define BT848_MAX_CLIP_NODE 100
402b20e9dccSfgsch struct _bktr_clip {
403b20e9dccSfgsch     struct bktr_clip x[BT848_MAX_CLIP_NODE];
404b20e9dccSfgsch };
405b20e9dccSfgsch 
406b20e9dccSfgsch /*
407b20e9dccSfgsch  * I'm using METEOR_xxx just because that will be common to other interface
408b20e9dccSfgsch  * and less of a surprise
409b20e9dccSfgsch  */
410b20e9dccSfgsch #define METEORSACTPIXFMT	_IOW('x', 64, int )
411b20e9dccSfgsch #define METEORGACTPIXFMT	_IOR('x', 64, int )
412b20e9dccSfgsch #define METEORGSUPPIXFMT	_IOWR('x', 65, struct meteor_pixfmt)
413b20e9dccSfgsch 
414b20e9dccSfgsch /* set clip list */
415b20e9dccSfgsch #define BT848SCLIP     _IOW('x', 66, struct _bktr_clip )
416b20e9dccSfgsch #define BT848GCLIP     _IOR('x', 66, struct _bktr_clip )
417b20e9dccSfgsch 
418b20e9dccSfgsch 
419b20e9dccSfgsch /* set input format */
420*8defa136Srobert #define BT848SFMT		_IOW('x', 67, unsigned int )
421*8defa136Srobert #define BT848GFMT		_IOR('x', 67, unsigned int )
422b20e9dccSfgsch 
423b20e9dccSfgsch /* set clear-buffer-on-start */
424b20e9dccSfgsch #define BT848SCBUF	_IOW('x', 68, int)
425b20e9dccSfgsch #define BT848GCBUF	_IOR('x', 68, int)
426b20e9dccSfgsch 
427b20e9dccSfgsch /* set capture area */
428b20e9dccSfgsch /* The capture area is the area of the video image which is grabbed */
429b20e9dccSfgsch /* Usually the capture area is 640x480 (768x576 PAL) pixels */
430b20e9dccSfgsch /* This area is then scaled to the dimensions the user requires */
431b20e9dccSfgsch /* using the METEORGEO ioctl */
432b20e9dccSfgsch /* However, the capture area could be 400x300 pixels from the top right */
433b20e9dccSfgsch /* corner of the video image */
434b20e9dccSfgsch struct bktr_capture_area {
435b20e9dccSfgsch    int      x_offset;
436b20e9dccSfgsch    int      y_offset;
437b20e9dccSfgsch    int      x_size;
438b20e9dccSfgsch    int      y_size;
439b20e9dccSfgsch };
440b20e9dccSfgsch #define BT848_SCAPAREA   _IOW('x', 69, struct bktr_capture_area)
441b20e9dccSfgsch #define BT848_GCAPAREA   _IOR('x', 69, struct bktr_capture_area)
442b20e9dccSfgsch 
443b20e9dccSfgsch 
444b20e9dccSfgsch /* Get channel Set */
445b20e9dccSfgsch #define BT848_MAX_CHNLSET_NAME_LEN 16
446b20e9dccSfgsch struct bktr_chnlset {
447b20e9dccSfgsch        short   index;
448b20e9dccSfgsch        short   max_channel;
449b20e9dccSfgsch        char    name[BT848_MAX_CHNLSET_NAME_LEN];
450b20e9dccSfgsch };
451b20e9dccSfgsch #define	TVTUNER_GETCHNLSET _IOWR('x', 70, struct bktr_chnlset)
452b20e9dccSfgsch 
453b20e9dccSfgsch 
454b20e9dccSfgsch 
455b20e9dccSfgsch /* Infra Red Remote Control */
456b20e9dccSfgsch struct bktr_remote {
457b20e9dccSfgsch        unsigned char data[3];
458b20e9dccSfgsch };
459b20e9dccSfgsch #define	REMOTE_GETKEY      _IOR('x', 71, struct bktr_remote)/*read the remote */
460b20e9dccSfgsch                                                             /*control receiver*/
461b20e9dccSfgsch                                                             /*returns raw data*/
462b20e9dccSfgsch 
463b20e9dccSfgsch 
464b20e9dccSfgsch /*
465b20e9dccSfgsch  * Direct access to GPIO pins. You must add BKTR_GPIO_ACCESS to your kernel
466b20e9dccSfgsch  * configuration file to use these
467b20e9dccSfgsch  */
468b20e9dccSfgsch #define BT848_GPIO_SET_EN      _IOW('x', 72, int)      /* set gpio_out_en */
469b20e9dccSfgsch #define BT848_GPIO_GET_EN      _IOR('x', 73, int)      /* get gpio_out_en */
470b20e9dccSfgsch #define BT848_GPIO_SET_DATA    _IOW('x', 74, int)      /* set gpio_data */
471b20e9dccSfgsch #define BT848_GPIO_GET_DATA    _IOR('x', 75, int)      /* get gpio_data */
472b20e9dccSfgsch 
473b20e9dccSfgsch 
474b20e9dccSfgsch 
475b20e9dccSfgsch /*  XXX - Copied from /sys/pci/brktree_reg.h  */
476b20e9dccSfgsch #define BT848_IFORM_FORMAT              (0x7<<0)
477b20e9dccSfgsch # define BT848_IFORM_F_RSVD             (0x7)
478b20e9dccSfgsch # define BT848_IFORM_F_SECAM            (0x6)
479b20e9dccSfgsch # define BT848_IFORM_F_PALN             (0x5)
480b20e9dccSfgsch # define BT848_IFORM_F_PALM             (0x4)
481b20e9dccSfgsch # define BT848_IFORM_F_PALBDGHI         (0x3)
482b20e9dccSfgsch # define BT848_IFORM_F_NTSCJ            (0x2)
483b20e9dccSfgsch # define BT848_IFORM_F_NTSCM            (0x1)
484b20e9dccSfgsch # define BT848_IFORM_F_AUTO             (0x0)
485b20e9dccSfgsch 
486b20e9dccSfgsch 
487b20e9dccSfgsch 
48866684438Sniklas /* XXX Silly constants not always defined by the environment.  */
48966684438Sniklas #ifndef TRUE
49066684438Sniklas #define TRUE 1
49166684438Sniklas #endif
49266684438Sniklas #ifndef FALSE
49366684438Sniklas #define FALSE 0
49466684438Sniklas #endif
49566684438Sniklas 
49666684438Sniklas 
497b20e9dccSfgsch #endif /* _DEV_IC_BT8XX_H_ */
498