ioctl_bt848.h revision 44063
123599Smarkm/*
223599Smarkm * extensions to ioctl_meteor.h for the bt848 cards
339838Ssos *
444063Sroger * $Id: ioctl_bt848.h,v 1.19 1998/09/30 21:06:55 sos Exp $
523599Smarkm */
623599Smarkm
723599Smarkm/*
824086Sfsmp * frequency sets
923599Smarkm */
1024086Sfsmp#define CHNLSET_NABCST		1
1124086Sfsmp#define CHNLSET_CABLEIRC	2
1224086Sfsmp#define CHNLSET_CABLEHRC	3
1324086Sfsmp#define CHNLSET_WEUROPE		4
1430193Smarkm#define CHNLSET_JPNBCST         5
1530193Smarkm#define CHNLSET_JPNCABLE        6
1639040Ssos#define CHNLSET_XUSSR           7
1730193Smarkm#define CHNLSET_MIN	        CHNLSET_NABCST
1839040Ssos#define CHNLSET_MAX	        CHNLSET_XUSSR
1923599Smarkm
2023599Smarkm
2123599Smarkm/*
2223936Sfsmp * constants for various tuner registers
2323936Sfsmp */
2423936Sfsmp#define BT848_HUEMIN		(-90)
2523936Sfsmp#define BT848_HUEMAX		90
2623936Sfsmp#define BT848_HUECENTER		0
2723936Sfsmp#define BT848_HUERANGE		179.3
2823936Sfsmp#define BT848_HUEREGMIN		(-128)
2923936Sfsmp#define BT848_HUEREGMAX		127
3023936Sfsmp#define BT848_HUESTEPS		256
3123936Sfsmp
3223936Sfsmp#define BT848_BRIGHTMIN		(-50)
3323936Sfsmp#define BT848_BRIGHTMAX		50
3423936Sfsmp#define BT848_BRIGHTCENTER	0
3523936Sfsmp#define BT848_BRIGHTRANGE	99.6
3623936Sfsmp#define BT848_BRIGHTREGMIN	(-128)
3723936Sfsmp#define BT848_BRIGHTREGMAX	127
3823936Sfsmp#define BT848_BRIGHTSTEPS	256
3923936Sfsmp
4023936Sfsmp#define BT848_CONTRASTMIN	0
4123936Sfsmp#define BT848_CONTRASTMAX	237
4223936Sfsmp#define BT848_CONTRASTCENTER	100
4323936Sfsmp#define BT848_CONTRASTRANGE	236.57
4423936Sfsmp#define BT848_CONTRASTREGMIN	0
4523936Sfsmp#define BT848_CONTRASTREGMAX	511
4623936Sfsmp#define BT848_CONTRASTSTEPS	512
4723936Sfsmp
4823936Sfsmp#define BT848_CHROMAMIN		0
4923936Sfsmp#define BT848_CHROMAMAX		284
5023936Sfsmp#define BT848_CHROMACENTER	100
5123936Sfsmp#define BT848_CHROMARANGE	283.89
5223936Sfsmp#define BT848_CHROMAREGMIN	0
5323936Sfsmp#define BT848_CHROMAREGMAX	511
5423936Sfsmp#define BT848_CHROMASTEPS	512
5523936Sfsmp
5623936Sfsmp#define BT848_SATUMIN		0
5723936Sfsmp#define BT848_SATUMAX		202
5823936Sfsmp#define BT848_SATUCENTER	100
5923936Sfsmp#define BT848_SATURANGE		201.18
6023936Sfsmp#define BT848_SATUREGMIN	0
6123936Sfsmp#define BT848_SATUREGMAX	511
6223936Sfsmp#define BT848_SATUSTEPS		512
6323936Sfsmp
6423936Sfsmp#define BT848_SATVMIN		0
6523936Sfsmp#define BT848_SATVMAX		284
6623936Sfsmp#define BT848_SATVCENTER	100
6723936Sfsmp#define BT848_SATVRANGE		283.89
6823936Sfsmp#define BT848_SATVREGMIN	0
6923936Sfsmp#define BT848_SATVREGMAX	511
7023936Sfsmp#define BT848_SATVSTEPS		512
7123936Sfsmp
7223936Sfsmp
7324086Sfsmp/*
7424086Sfsmp * audio stuff
7524086Sfsmp */
7624086Sfsmp#define AUDIO_TUNER		0x00	/* command for the audio routine */
7724086Sfsmp#define AUDIO_EXTERN		0x01	/* don't confuse them with bit */
7824086Sfsmp#define AUDIO_INTERN		0x02	/* settings */
7924086Sfsmp#define AUDIO_MUTE		0x80
8024086Sfsmp#define AUDIO_UNMUTE		0x81
8124086Sfsmp
8224086Sfsmp
8324086Sfsmp/*
8424086Sfsmp * EEProm stuff
8524086Sfsmp */
8624045Sfsmpstruct eeProm {
8724244Sfsmp	short	offset;
8824244Sfsmp	short	count;
8924244Sfsmp	u_char	bytes[ 256 ];
9024045Sfsmp};
9124045Sfsmp
9224045Sfsmp
9323936Sfsmp/*
9423599Smarkm * XXX: this is a hack, should be in ioctl_meteor.h
9523599Smarkm * here to avoid touching that file for now...
9623599Smarkm */
9723599Smarkm#define	TVTUNER_SETCHNL    _IOW('x', 32, unsigned int)	/* set channel */
9823599Smarkm#define	TVTUNER_GETCHNL    _IOR('x', 32, unsigned int)	/* get channel */
9923599Smarkm#define	TVTUNER_SETTYPE    _IOW('x', 33, unsigned int)	/* set tuner type */
10023599Smarkm#define	TVTUNER_GETTYPE    _IOR('x', 33, unsigned int)	/* get tuner type */
10123599Smarkm#define	TVTUNER_GETSTATUS  _IOR('x', 34, unsigned int)	/* get tuner status */
10223936Sfsmp#define	TVTUNER_SETFREQ    _IOW('x', 35, unsigned int)	/* set frequency */
10323936Sfsmp#define	TVTUNER_GETFREQ    _IOR('x', 36, unsigned int)	/* get frequency */
10443889Sroger
10523599Smarkm
10624086Sfsmp#define BT848_SHUE	_IOW('x', 37, int)		/* set hue */
10724086Sfsmp#define BT848_GHUE	_IOR('x', 37, int)		/* get hue */
10823936Sfsmp#define	BT848_SBRIG	_IOW('x', 38, int)		/* set brightness */
10924086Sfsmp#define BT848_GBRIG	_IOR('x', 38, int)		/* get brightness */
11023936Sfsmp#define	BT848_SCSAT	_IOW('x', 39, int)		/* set chroma sat */
11124086Sfsmp#define BT848_GCSAT	_IOR('x', 39, int)		/* get UV saturation */
11224086Sfsmp#define	BT848_SCONT	_IOW('x', 40, int)		/* set contrast */
11323936Sfsmp#define	BT848_GCONT	_IOR('x', 40, int)		/* get contrast */
11423936Sfsmp#define	BT848_SVSAT	_IOW('x', 41, int)		/* set chroma V sat */
11524086Sfsmp#define BT848_GVSAT	_IOR('x', 41, int)		/* get V saturation */
11623936Sfsmp#define	BT848_SUSAT	_IOW('x', 42, int)		/* set chroma U sat */
11724086Sfsmp#define BT848_GUSAT	_IOR('x', 42, int)		/* get U saturation */
11823936Sfsmp
11924045Sfsmp#define	BT848_SCBARS	_IOR('x', 43, int)		/* set colorbar */
12024045Sfsmp#define	BT848_CCBARS	_IOR('x', 44, int)		/* clear colorbar */
12123936Sfsmp
12224045Sfsmp
12324086Sfsmp#define	BT848_SAUDIO	_IOW('x', 46, int)		/* set audio channel */
12424086Sfsmp#define BT848_GAUDIO	_IOR('x', 47, int)		/* get audio channel */
12524086Sfsmp#define	BT848_SBTSC	_IOW('x', 48, int)		/* set audio channel */
12624086Sfsmp
12724244Sfsmp#define	BT848_GSTATUS	_IOR('x', 49, unsigned int)	/* reap status */
12824244Sfsmp
12924528Sfsmp#define	BT848_WEEPROM	_IOWR('x', 50, struct eeProm)	/* write to EEProm */
13024528Sfsmp#define	BT848_REEPROM	_IOWR('x', 51, struct eeProm)	/* read from EEProm */
13124244Sfsmp
13224528Sfsmp#define	BT848_SIGNATURE	_IOWR('x', 52, struct eeProm)	/* read card sig */
13324528Sfsmp
13424528Sfsmp#define	TVTUNER_SETAFC	_IOW('x', 53, int)		/* turn AFC on/off */
13524528Sfsmp#define TVTUNER_GETAFC	_IOR('x', 54, int)		/* query AFC on/off */
13629233Smarkm#define BT848_SLNOTCH	_IOW('x', 55, int)		/* set luma notch */
13729233Smarkm#define BT848_GLNOTCH	_IOR('x', 56, int)		/* get luma notch */
13824528Sfsmp
13944063Sroger/* Read/Write the BT848's I2C bus directly
14044063Sroger * b7-b0:    data (read/write)
14144063Sroger * b15-b8:   internal peripheral register (write)
14244063Sroger * b23-b16:  i2c addr (write)
14344063Sroger * b31-b24:  1 = write, 0 = read
14444063Sroger */
14544063Sroger#define BT848_I2CWR     _IOWR('x', 57, u_long)    /* i2c read-write */
14643889Sroger
14744063Sroger/* Support for radio tuner */
14844063Sroger#define RADIO_SETMODE	 _IOW('x', 58, unsigned int)  /* set radio modes */
14944063Sroger#define RADIO_GETMODE	 _IOR('x', 58, unsigned char)  /* get radio modes */
15044063Sroger#define   RADIO_AFC	 0x01		/* These modes will probably not */
15144063Sroger#define   RADIO_MONO	 0x02		/*  work on the FRxxxx. It does	 */
15244063Sroger#define   RADIO_MUTE	 0x08		/*  work on the FMxxxx.	*/
15344063Sroger#define RADIO_SETFREQ    _IOW('x', 59, unsigned int)  /* set frequency   */
15444063Sroger#define RADIO_GETFREQ    _IOR('x', 59, unsigned int)  /* set frequency   */
15544063Sroger /*        Argument is frequency*100MHz  */
15643889Sroger
15723599Smarkm/*
15823599Smarkm * XXX: more bad magic,
15923599Smarkm *      we need to fix the METEORGINPUT to return something public
16023599Smarkm *      duplicate them here for now...
16123599Smarkm */
16223599Smarkm#define	METEOR_DEV0		0x00001000
16323599Smarkm#define	METEOR_DEV1		0x00002000
16423599Smarkm#define	METEOR_DEV2		0x00004000
16543348Sroger#define	METEOR_DEV3		0x00008000
16643348Sroger#define	METEOR_DEV_SVIDEO	0x00006000
16725328Sfsmp/*
16825328Sfsmp * right now I don't know were to put these, but as they are suppose to be
16925328Sfsmp * a part of a common video capture interface, these should be relocated to
17025328Sfsmp * another place.  Probably most of the METEOR_xxx defines need to be
17125328Sfsmp * renamed and moved to a common header
17225328Sfsmp */
17325328Sfsmp
17429233Smarkmtypedef enum { METEOR_PIXTYPE_RGB, METEOR_PIXTYPE_YUV,
17531186Sahasty	       METEOR_PIXTYPE_YUV_PACKED,
17631186Sahasty	       METEOR_PIXTYPE_YUV_12 } METEOR_PIXTYPE;
17725328Sfsmp
17831186Sahasty
17925328Sfsmpstruct meteor_pixfmt {
18025328Sfsmp	u_int          index;         /* Index in supported pixfmt list     */
18125328Sfsmp	METEOR_PIXTYPE type;          /* What's the board gonna feed us     */
18225328Sfsmp	u_int          Bpp;           /* Bytes per pixel                    */
18325328Sfsmp	u_long         masks[3];      /* R,G,B or Y,U,V masks, respectively */
18425328Sfsmp	unsigned       swap_bytes :1; /* Bytes  swapped within shorts       */
18525328Sfsmp	unsigned       swap_shorts:1; /* Shorts swapped within longs        */
18625328Sfsmp};
18725328Sfsmp
18825328Sfsmp
18925328Sfsmpstruct bktr_clip {
19025328Sfsmp    int          x_min;
19125328Sfsmp    int          x_max;
19225328Sfsmp    int          y_min;
19325328Sfsmp    int          y_max;
19425328Sfsmp};
19525328Sfsmp
19625328Sfsmp#define BT848_MAX_CLIP_NODE 100
19725328Sfsmpstruct _bktr_clip {
19825328Sfsmp    struct bktr_clip x[BT848_MAX_CLIP_NODE];
19925328Sfsmp};
20025328Sfsmp
20125328Sfsmp/*
20225328Sfsmp * I'm using METEOR_xxx just because that will be common to other interface
20325328Sfsmp * and less of a surprise
20425328Sfsmp */
20525328Sfsmp#define METEORSACTPIXFMT	_IOW('x', 64, int )
20625328Sfsmp#define METEORGACTPIXFMT	_IOR('x', 64, int )
20725328Sfsmp#define METEORGSUPPIXFMT	_IOWR('x', 65, struct meteor_pixfmt)
20825328Sfsmp
20925328Sfsmp/* set clip list */
21025328Sfsmp#define BT848SCLIP     _IOW('x', 66, struct _bktr_clip )
21125328Sfsmp#define BT848GCLIP     _IOR('x', 66, struct _bktr_clip )
21230193Smarkm
21330193Smarkm
21430193Smarkm/* set input format */
21530193Smarkm#define BT848SFMT		_IOW('x', 67, unsigned long )
21630193Smarkm#define BT848GFMT		_IOR('x', 67, unsigned long )
21730193Smarkm
21836090Sahasty/* set clear-buffer-on-start */
21936090Sahasty#define BT848SCBUF	_IOW('x', 68, int)
22036090Sahasty#define BT848GCBUF	_IOR('x', 68, int)
22136090Sahasty
22238706Ssos/* set capture area */
22338706Ssos/* The capture area is the area of the video image which is grabbed */
22438706Ssos/* Usually the capture area is 640x480 (768x576 PAL) pixels */
22538706Ssos/* This area is then scaled to the dimensions the user requires */
22638706Ssos/* using the METEORGEO ioctl */
22738706Ssos/* However, the capture area could be 400x300 pixels from the top right */
22838706Ssos/* corner of the video image */
22938706Ssosstruct bktr_capture_area {
23038706Ssos   int      x_offset;
23138706Ssos   int      y_offset;
23238706Ssos   int      x_size;
23338706Ssos   int      y_size;
23438706Ssos};
23538707Ssos#define BT848_SCAPAREA   _IOW('x', 69, struct bktr_capture_area)
23638707Ssos#define BT848_GCAPAREA   _IOR('x', 69, struct bktr_capture_area)
23736090Sahasty
23844063Sroger
23944063Sroger/* Get channel Set */
24044063Sroger#define BT848_MAX_CHNLSET_NAME_LEN 16
24144063Srogerstruct bktr_chnlset {
24244063Sroger       short   index;
24344063Sroger       short   max_channel;
24444063Sroger       char    name[BT848_MAX_CHNLSET_NAME_LEN];
24544063Sroger};
24644063Sroger#define	TVTUNER_GETCHNLSET _IOWR('x', 70, struct bktr_chnlset)
24744063Sroger
24844063Sroger
24944063Sroger
25044063Sroger/* Infra Red Remote Control */
25144063Srogerstruct bktr_remote {
25244063Sroger       unsigned char data[3];
25344063Sroger};
25444063Sroger#define	REMOTE_GETKEY      _IOR('x', 71, struct bktr_remote)/*read the remote */
25544063Sroger                                                            /*control receiver*/
25644063Sroger                                                            /*returns raw data*/
25744063Sroger
25844063Sroger
25944063Sroger/*
26044063Sroger * Direct access to GPIO pins. You must add BKTR_GPIO_ACCESS to your kernel
26144063Sroger * configuration file to use these
26230979Smarkm */
26344063Sroger#define BT848_GPIO_SET_EN      _IOW('x', 72, int)      /* set gpio_out_en */
26444063Sroger#define BT848_GPIO_GET_EN      _IOR('x', 73, int)      /* get gpio_out_en */
26544063Sroger#define BT848_GPIO_SET_DATA    _IOW('x', 74, int)      /* set gpio_data */
26644063Sroger#define BT848_GPIO_GET_DATA    _IOR('x', 75, int)      /* get gpio_data */
26730979Smarkm
26844063Sroger
26944063Sroger
27030193Smarkm/*  XXX - Copied from /sys/pci/brktree_reg.h  */
27130193Smarkm#define BT848_IFORM_FORMAT              (0x7<<0)
27230193Smarkm# define BT848_IFORM_F_RSVD             (0x7)
27330193Smarkm# define BT848_IFORM_F_SECAM            (0x6)
27430193Smarkm# define BT848_IFORM_F_PALN             (0x5)
27530193Smarkm# define BT848_IFORM_F_PALM             (0x4)
27630193Smarkm# define BT848_IFORM_F_PALBDGHI         (0x3)
27730193Smarkm# define BT848_IFORM_F_NTSCJ            (0x2)
27830193Smarkm# define BT848_IFORM_F_NTSCM            (0x1)
27930193Smarkm# define BT848_IFORM_F_AUTO             (0x0)
28030193Smarkm
281