ioctl_bt848.h revision 56532
1/*
2 * extensions to ioctl_meteor.h for the bt848 cards
3 *
4 * $FreeBSD: head/sys/dev/bktr/ioctl_bt848.h 56532 2000-01-24 14:00:34Z roger $
5 */
6
7/*
8 * frequency sets
9 */
10#define CHNLSET_NABCST		1
11#define CHNLSET_CABLEIRC	2
12#define CHNLSET_CABLEHRC	3
13#define CHNLSET_WEUROPE		4
14#define CHNLSET_JPNBCST         5
15#define CHNLSET_JPNCABLE        6
16#define CHNLSET_XUSSR           7
17#define CHNLSET_AUSTRALIA       8
18#define CHNLSET_FRANCE          9
19#define CHNLSET_MIN	        CHNLSET_NABCST
20#define CHNLSET_MAX	        CHNLSET_FRANCE
21
22
23/*
24 * constants for various tuner registers
25 */
26#define BT848_HUEMIN		(-90)
27#define BT848_HUEMAX		90
28#define BT848_HUECENTER		0
29#define BT848_HUERANGE		179.3
30#define BT848_HUEREGMIN		(-128)
31#define BT848_HUEREGMAX		127
32#define BT848_HUESTEPS		256
33
34#define BT848_BRIGHTMIN		(-50)
35#define BT848_BRIGHTMAX		50
36#define BT848_BRIGHTCENTER	0
37#define BT848_BRIGHTRANGE	99.6
38#define BT848_BRIGHTREGMIN	(-128)
39#define BT848_BRIGHTREGMAX	127
40#define BT848_BRIGHTSTEPS	256
41
42#define BT848_CONTRASTMIN	0
43#define BT848_CONTRASTMAX	237
44#define BT848_CONTRASTCENTER	100
45#define BT848_CONTRASTRANGE	236.57
46#define BT848_CONTRASTREGMIN	0
47#define BT848_CONTRASTREGMAX	511
48#define BT848_CONTRASTSTEPS	512
49
50#define BT848_CHROMAMIN		0
51#define BT848_CHROMAMAX		284
52#define BT848_CHROMACENTER	100
53#define BT848_CHROMARANGE	283.89
54#define BT848_CHROMAREGMIN	0
55#define BT848_CHROMAREGMAX	511
56#define BT848_CHROMASTEPS	512
57
58#define BT848_SATUMIN		0
59#define BT848_SATUMAX		202
60#define BT848_SATUCENTER	100
61#define BT848_SATURANGE		201.18
62#define BT848_SATUREGMIN	0
63#define BT848_SATUREGMAX	511
64#define BT848_SATUSTEPS		512
65
66#define BT848_SATVMIN		0
67#define BT848_SATVMAX		284
68#define BT848_SATVCENTER	100
69#define BT848_SATVRANGE		283.89
70#define BT848_SATVREGMIN	0
71#define BT848_SATVREGMAX	511
72#define BT848_SATVSTEPS		512
73
74
75/*
76 * audio stuff
77 */
78#define AUDIO_TUNER		0x00	/* command for the audio routine */
79#define AUDIO_EXTERN		0x01	/* don't confuse them with bit */
80#define AUDIO_INTERN		0x02	/* settings */
81#define AUDIO_MUTE		0x80
82#define AUDIO_UNMUTE		0x81
83
84
85/*
86 * EEProm stuff
87 */
88struct eeProm {
89	short	offset;
90	short	count;
91	u_char	bytes[ 256 ];
92};
93
94
95/*
96 * XXX: this is a hack, should be in ioctl_meteor.h
97 * here to avoid touching that file for now...
98 */
99#define	TVTUNER_SETCHNL    _IOW('x', 32, unsigned int)	/* set channel */
100#define	TVTUNER_GETCHNL    _IOR('x', 32, unsigned int)	/* get channel */
101#define	TVTUNER_SETTYPE    _IOW('x', 33, unsigned int)	/* set tuner type */
102#define	TVTUNER_GETTYPE    _IOR('x', 33, unsigned int)	/* get tuner type */
103#define	TVTUNER_GETSTATUS  _IOR('x', 34, unsigned int)	/* get tuner status */
104#define	TVTUNER_SETFREQ    _IOW('x', 35, unsigned int)	/* set frequency */
105#define	TVTUNER_GETFREQ    _IOR('x', 36, unsigned int)	/* get frequency */
106
107
108#define BT848_SHUE	_IOW('x', 37, int)		/* set hue */
109#define BT848_GHUE	_IOR('x', 37, int)		/* get hue */
110#define	BT848_SBRIG	_IOW('x', 38, int)		/* set brightness */
111#define BT848_GBRIG	_IOR('x', 38, int)		/* get brightness */
112#define	BT848_SCSAT	_IOW('x', 39, int)		/* set chroma sat */
113#define BT848_GCSAT	_IOR('x', 39, int)		/* get UV saturation */
114#define	BT848_SCONT	_IOW('x', 40, int)		/* set contrast */
115#define	BT848_GCONT	_IOR('x', 40, int)		/* get contrast */
116#define	BT848_SVSAT	_IOW('x', 41, int)		/* set chroma V sat */
117#define BT848_GVSAT	_IOR('x', 41, int)		/* get V saturation */
118#define	BT848_SUSAT	_IOW('x', 42, int)		/* set chroma U sat */
119#define BT848_GUSAT	_IOR('x', 42, int)		/* get U saturation */
120
121#define	BT848_SCBARS	_IOR('x', 43, int)		/* set colorbar */
122#define	BT848_CCBARS	_IOR('x', 44, int)		/* clear colorbar */
123
124
125#define	BT848_SAUDIO	_IOW('x', 46, int)		/* set audio channel */
126#define BT848_GAUDIO	_IOR('x', 47, int)		/* get audio channel */
127#define	BT848_SBTSC	_IOW('x', 48, int)		/* set audio channel */
128
129#define	BT848_GSTATUS	_IOR('x', 49, unsigned int)	/* reap status */
130
131#define	BT848_WEEPROM	_IOWR('x', 50, struct eeProm)	/* write to EEProm */
132#define	BT848_REEPROM	_IOWR('x', 51, struct eeProm)	/* read from EEProm */
133
134#define	BT848_SIGNATURE	_IOWR('x', 52, struct eeProm)	/* read card sig */
135
136#define	TVTUNER_SETAFC	_IOW('x', 53, int)		/* turn AFC on/off */
137#define TVTUNER_GETAFC	_IOR('x', 54, int)		/* query AFC on/off */
138#define BT848_SLNOTCH	_IOW('x', 55, int)		/* set luma notch */
139#define BT848_GLNOTCH	_IOR('x', 56, int)		/* get luma notch */
140
141/* Read/Write the BT848's I2C bus directly
142 * b7-b0:    data (read/write)
143 * b15-b8:   internal peripheral register (write)
144 * b23-b16:  i2c addr (write)
145 * b31-b24:  1 = write, 0 = read
146 */
147#define BT848_I2CWR     _IOWR('x', 57, u_long)    /* i2c read-write */
148
149/* Support for radio tuner */
150#define RADIO_SETMODE	 _IOW('x', 58, unsigned int)  /* set radio modes */
151#define RADIO_GETMODE	 _IOR('x', 58, unsigned char)  /* get radio modes */
152#define   RADIO_AFC	 0x01		/* These modes will probably not */
153#define   RADIO_MONO	 0x02		/*  work on the FRxxxx. It does	 */
154#define   RADIO_MUTE	 0x08		/*  work on the FMxxxx.	*/
155#define RADIO_SETFREQ    _IOW('x', 59, unsigned int)  /* set frequency   */
156#define RADIO_GETFREQ    _IOR('x', 59, unsigned int)  /* set frequency   */
157 /*        Argument is frequency*100MHz  */
158
159/*
160 * XXX: more bad magic,
161 *      we need to fix the METEORGINPUT to return something public
162 *      duplicate them here for now...
163 */
164#define	METEOR_DEV0		0x00001000
165#define	METEOR_DEV1		0x00002000
166#define	METEOR_DEV2		0x00004000
167#define	METEOR_DEV3		0x00008000
168#define	METEOR_DEV_SVIDEO	0x00006000
169/*
170 * right now I don't know were to put these, but as they are suppose to be
171 * a part of a common video capture interface, these should be relocated to
172 * another place.  Probably most of the METEOR_xxx defines need to be
173 * renamed and moved to a common header
174 */
175
176typedef enum { METEOR_PIXTYPE_RGB, METEOR_PIXTYPE_YUV,
177	       METEOR_PIXTYPE_YUV_PACKED,
178	       METEOR_PIXTYPE_YUV_12 } METEOR_PIXTYPE;
179
180
181struct meteor_pixfmt {
182	u_int          index;         /* Index in supported pixfmt list     */
183	METEOR_PIXTYPE type;          /* What's the board gonna feed us     */
184	u_int          Bpp;           /* Bytes per pixel                    */
185	u_long         masks[3];      /* R,G,B or Y,U,V masks, respectively */
186	unsigned       swap_bytes :1; /* Bytes  swapped within shorts       */
187	unsigned       swap_shorts:1; /* Shorts swapped within longs        */
188};
189
190
191struct bktr_clip {
192    int          x_min;
193    int          x_max;
194    int          y_min;
195    int          y_max;
196};
197
198#define BT848_MAX_CLIP_NODE 100
199struct _bktr_clip {
200    struct bktr_clip x[BT848_MAX_CLIP_NODE];
201};
202
203/*
204 * I'm using METEOR_xxx just because that will be common to other interface
205 * and less of a surprise
206 */
207#define METEORSACTPIXFMT	_IOW('x', 64, int )
208#define METEORGACTPIXFMT	_IOR('x', 64, int )
209#define METEORGSUPPIXFMT	_IOWR('x', 65, struct meteor_pixfmt)
210
211/* set clip list */
212#define BT848SCLIP     _IOW('x', 66, struct _bktr_clip )
213#define BT848GCLIP     _IOR('x', 66, struct _bktr_clip )
214
215
216/* set input format */
217#define BT848SFMT		_IOW('x', 67, unsigned long )
218#define BT848GFMT		_IOR('x', 67, unsigned long )
219
220/* set clear-buffer-on-start */
221#define BT848SCBUF	_IOW('x', 68, int)
222#define BT848GCBUF	_IOR('x', 68, int)
223
224/* set capture area */
225/* The capture area is the area of the video image which is grabbed */
226/* Usually the capture area is 640x480 (768x576 PAL) pixels */
227/* This area is then scaled to the dimensions the user requires */
228/* using the METEORGEO ioctl */
229/* However, the capture area could be 400x300 pixels from the top right */
230/* corner of the video image */
231struct bktr_capture_area {
232   int      x_offset;
233   int      y_offset;
234   int      x_size;
235   int      y_size;
236};
237#define BT848_SCAPAREA   _IOW('x', 69, struct bktr_capture_area)
238#define BT848_GCAPAREA   _IOR('x', 69, struct bktr_capture_area)
239
240
241/* Get channel Set */
242#define BT848_MAX_CHNLSET_NAME_LEN 16
243struct bktr_chnlset {
244       short   index;
245       short   max_channel;
246       char    name[BT848_MAX_CHNLSET_NAME_LEN];
247};
248#define	TVTUNER_GETCHNLSET _IOWR('x', 70, struct bktr_chnlset)
249
250
251
252/* Infra Red Remote Control */
253struct bktr_remote {
254       unsigned char data[3];
255};
256#define	REMOTE_GETKEY      _IOR('x', 71, struct bktr_remote)/*read the remote */
257                                                            /*control receiver*/
258                                                            /*returns raw data*/
259
260
261/*
262 * Direct access to GPIO pins. You must add BKTR_GPIO_ACCESS to your kernel
263 * configuration file to use these
264 */
265#define BT848_GPIO_SET_EN      _IOW('x', 72, int)      /* set gpio_out_en */
266#define BT848_GPIO_GET_EN      _IOR('x', 73, int)      /* get gpio_out_en */
267#define BT848_GPIO_SET_DATA    _IOW('x', 74, int)      /* set gpio_data */
268#define BT848_GPIO_GET_DATA    _IOR('x', 75, int)      /* get gpio_data */
269
270
271
272/*  XXX - Copied from /sys/pci/brktree_reg.h  */
273#define BT848_IFORM_FORMAT              (0x7<<0)
274# define BT848_IFORM_F_RSVD             (0x7)
275# define BT848_IFORM_F_SECAM            (0x6)
276# define BT848_IFORM_F_PALN             (0x5)
277# define BT848_IFORM_F_PALM             (0x4)
278# define BT848_IFORM_F_PALBDGHI         (0x3)
279# define BT848_IFORM_F_NTSCJ            (0x2)
280# define BT848_IFORM_F_NTSCM            (0x1)
281# define BT848_IFORM_F_AUTO             (0x0)
282
283