bktr_reg.h revision 38706
123599Smarkm/*
223599Smarkm * Copyright (c) 1995 Mark Tinguely and Jim Lowe
323599Smarkm * All rights reserved.
423599Smarkm *
523599Smarkm * Redistribution and use in source and binary forms, with or without
623599Smarkm * modification, are permitted provided that the following conditions
723599Smarkm * are met:
823599Smarkm * 1. Redistributions of source code must retain the above copyright
923599Smarkm *    notice, this list of conditions and the following disclaimer.
1023599Smarkm * 2. Redistributions in binary form must reproduce the above copyright
1123599Smarkm *    notice, this list of conditions and the following disclaimer in the
1223599Smarkm *    documentation and/or other materials provided with the distribution.
1323599Smarkm * 3. All advertising materials mentioning features or use of this software
1423599Smarkm *    must display the following acknowledgement:
1523599Smarkm *	This product includes software developed by Mark Tinguely and Jim Lowe
1623599Smarkm * 4. The name of the author may not be used to endorse or promote products
1723599Smarkm *    derived from this software without specific prior written permission.
1823599Smarkm *
1923599Smarkm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2023599Smarkm * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2123599Smarkm * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2223599Smarkm * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
2323599Smarkm * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2423599Smarkm * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2523599Smarkm * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2623599Smarkm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
2723599Smarkm * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
2823599Smarkm * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2923599Smarkm * POSSIBILITY OF SUCH DAMAGE.
3023599Smarkm */
3123599Smarkm#ifndef PCI_LATENCY_TIMER
3223599Smarkm#define	PCI_LATENCY_TIMER		0x0c	/* pci timer register */
3323599Smarkm#endif
3423599Smarkm
3523599Smarkm/*
3623599Smarkm * Definitions for the Philips SAA7116 digital video to pci interface.
3723599Smarkm */
3823599Smarkm#define	BROOKTREE_848_ID			0x0350109E
3935050Sahasty#define BROOKTREE_849_ID                        0x0351109E
4037611Sahasty#define BROOKTREE_878_ID                        0x036E109E
4137611Sahasty#define BROOKTREE_879_ID                        0x036F109E
4223599Smarkm
4324246Sfsmptypedef volatile u_int 	bregister_t;
4424246Sfsmp/*
4524246Sfsmp * if other persuasion endian, then compiler will probably require that
4624246Sfsmp * these next
4724246Sfsmp * macros be reversed
4824246Sfsmp */
4924246Sfsmp#define	BTBYTE(what)	bregister_t  what:8; int :24
5024246Sfsmp#define	BTWORD(what)	bregister_t  what:16; int: 16
5124246Sfsmp#define BTLONG(what)	bregister_t  what:32
5223599Smarkm
5324246Sfsmpstruct bt848_registers {
5424246Sfsmp    BTBYTE (dstatus);		/* 0, 1,2,3 */
5524528Sfsmp#define BT848_DSTATUS_PRES		(1<<7)
5624528Sfsmp#define BT848_DSTATUS_HLOC		(1<<6)
5724528Sfsmp#define BT848_DSTATUS_FIELD		(1<<5)
5824528Sfsmp#define BT848_DSTATUS_NUML		(1<<4)
5924528Sfsmp#define BT848_DSTATUS_CSEL		(1<<3)
6024528Sfsmp#define BT848_DSTATUS_LOF		(1<<1)
6124528Sfsmp#define BT848_DSTATUS_COF		(1<<0)
6224246Sfsmp    BTBYTE (iform);		/* 4, 5,6,7 */
6324528Sfsmp#define BT848_IFORM_MUXSEL		(0x3<<5)
6424528Sfsmp# define BT848_IFORM_M_MUX1		(0x03<<5)
6524528Sfsmp# define BT848_IFORM_M_MUX0		(0x02<<5)
6624528Sfsmp# define BT848_IFORM_M_MUX2		(0x01<<5)
6737611Sahasty# define BT848_IFORM_M_MUX3		(0x0)
6824528Sfsmp# define BT848_IFORM_M_RSVD		(0x00<<5)
6924528Sfsmp#define BT848_IFORM_XTSEL		(0x3<<3)
7024528Sfsmp# define BT848_IFORM_X_AUTO		(0x03<<3)
7124528Sfsmp# define BT848_IFORM_X_XT1		(0x02<<3)
7224528Sfsmp# define BT848_IFORM_X_XT0		(0x01<<3)
7324528Sfsmp# define BT848_IFORM_X_RSVD		(0x00<<3)
7424246Sfsmp    BTBYTE (tdec);		/* 8, 9,a,b */
7524246Sfsmp    BTBYTE (e_crop);		/* c, d,e,f */
7624246Sfsmp    BTBYTE (e_vdelay_lo);	/* 10, 11,12,13 */
7724246Sfsmp    BTBYTE (e_vactive_lo);	/* 14, 15,16,17 */
7824246Sfsmp    BTBYTE (e_delay_lo);	/* 18, 19,1a,1b */
7924246Sfsmp    BTBYTE (e_hactive_lo);	/* 1c, 1d,1e,1f */
8024246Sfsmp    BTBYTE (e_hscale_hi);	/* 20, 21,22,23 */
8124246Sfsmp    BTBYTE (e_hscale_lo);	/* 24, 25,26,27 */
8224246Sfsmp    BTBYTE (bright);		/* 28, 29,2a,2b */
8324246Sfsmp    BTBYTE (e_control);		/* 2c, 2d,2e,2f */
8424528Sfsmp#define BT848_E_CONTROL_LNOTCH		(1<<7)
8524528Sfsmp#define BT848_E_CONTROL_COMP		(1<<6)
8624528Sfsmp#define BT848_E_CONTROL_LDEC		(1<<5)
8724528Sfsmp#define BT848_E_CONTROL_CBSENSE		(1<<4)
8824528Sfsmp#define BT848_E_CONTROL_RSVD		(1<<3)
8924528Sfsmp#define BT848_E_CONTROL_CON_MSB		(1<<2)
9024528Sfsmp#define BT848_E_CONTROL_SAT_U_MSB	(1<<1)
9124528Sfsmp#define BT848_E_CONTROL_SAT_V_MSB	(1<<0)
9224246Sfsmp    BTBYTE (contrast_lo);	/* 30, 31,32,33 */
9324246Sfsmp    BTBYTE (sat_u_lo);		/* 34, 35,36,37 */
9424246Sfsmp    BTBYTE (sat_v_lo);		/* 38, 39,3a,3b */
9524246Sfsmp    BTBYTE (hue);		/* 3c, 3d,3e,3f */
9624246Sfsmp    BTBYTE (e_scloop);		/* 40, 41,42,43 */
9724528Sfsmp#define BT848_E_SCLOOP_RSVD1		(1<<7)
9824528Sfsmp#define BT848_E_SCLOOP_CAGC		(1<<6)
9924528Sfsmp#define BT848_E_SCLOOP_CKILL		(1<<5)
10024528Sfsmp#define BT848_E_SCLOOP_HFILT		(0x3<<3)
10124528Sfsmp# define BT848_E_SCLOOP_HFILT_ICON	(0x3<<3)
10224528Sfsmp# define BT848_E_SCLOOP_HFILT_QCIF	(0x2<<3)
10324528Sfsmp# define BT848_E_SCLOOP_HFILT_CIF	(0x1<<3)
10424528Sfsmp# define BT848_E_SCLOOP_HFILT_AUTO	(0x0<<3)
10524528Sfsmp#define BT848_E_SCLOOP_RSVD0		(0x7<<0)
10624246Sfsmp    int		:32;		/* 44, 45,46,47 */
10724246Sfsmp    BTBYTE (oform);		/* 48, 49,4a,4b */
10824246Sfsmp    BTBYTE (e_vscale_hi);	/* 4c, 4d,4e,4f */
10924246Sfsmp    BTBYTE (e_vscale_lo);	/* 50, 51,52,53 */
11024246Sfsmp    BTBYTE (test);		/* 54, 55,56,57 */
11124246Sfsmp    int		:32;		/* 58, 59,5a,5b */
11224246Sfsmp    int		:32;		/* 5c, 5d,5e,5f */
11324246Sfsmp    BTLONG (adelay);		/* 60, 61,62,63 */
11424246Sfsmp    BTBYTE (bdelay);		/* 64, 65,66,67 */
11524246Sfsmp    BTBYTE (adc);		/* 68, 69,6a,6b */
11624528Sfsmp#define BT848_ADC_RESERVED		(0x80)	/* required pattern */
11724528Sfsmp#define BT848_ADC_SYNC_T		(1<<5)
11824528Sfsmp#define BT848_ADC_AGC_EN		(1<<4)
11924528Sfsmp#define BT848_ADC_CLK_SLEEP		(1<<3)
12024528Sfsmp#define BT848_ADC_Y_SLEEP		(1<<2)
12124528Sfsmp#define BT848_ADC_C_SLEEP		(1<<1)
12224528Sfsmp#define BT848_ADC_CRUSH			(1<<0)
12324246Sfsmp    BTBYTE (e_vtc);		/* 6c, 6d,6e,6f */
12424246Sfsmp    int		:32;		/* 70, 71,72,73 */
12524246Sfsmp    int 	:32;		/* 74, 75,76,77 */
12624246Sfsmp    int		:32;		/* 78, 79,7a,7b */
12724246Sfsmp    BTLONG (sreset);		/* 7c, 7d,7e,7f */
12824246Sfsmp    u_char 	filler[0x8c-0x80];
12924246Sfsmp    BTBYTE (o_crop);		/* 8c, 8d,8e,8f */
13024246Sfsmp    BTBYTE (o_vdelay_lo);	/* 90, 91,92,93 */
13124246Sfsmp    BTBYTE (o_vactive_lo);	/* 94, 95,96,97 */
13224246Sfsmp    BTBYTE (o_delay_lo);	/* 98, 99,9a,9b */
13324246Sfsmp    BTBYTE (o_hactive_lo);	/* 9c, 9d,9e,9f */
13424246Sfsmp    BTBYTE (o_hscale_hi);	/* a0, a1,a2,a3 */
13524246Sfsmp    BTBYTE (o_hscale_lo);	/* a4, a5,a6,a7 */
13624246Sfsmp    int		:32;		/* a8, a9,aa,ab */
13724246Sfsmp    BTBYTE (o_control);		/* ac, ad,ae,af */
13824528Sfsmp#define BT848_O_CONTROL_LNOTCH		(1<<7)
13924528Sfsmp#define BT848_O_CONTROL_COMP		(1<<6)
14024528Sfsmp#define BT848_O_CONTROL_LDEC		(1<<5)
14124528Sfsmp#define BT848_O_CONTROL_CBSENSE		(1<<4)
14224528Sfsmp#define BT848_O_CONTROL_RSVD		(1<<3)
14324528Sfsmp#define BT848_O_CONTROL_CON_MSB		(1<<2)
14424528Sfsmp#define BT848_O_CONTROL_SAT_U_MSB	(1<<1)
14524528Sfsmp#define BT848_O_CONTROL_SAT_V_MSB	(1<<0)
14624246Sfsmp    u_char	fillter1[16];
14724246Sfsmp    BTBYTE (o_scloop);		/* c0, c1,c2,c3 */
14824528Sfsmp#define BT848_O_SCLOOP_RSVD1		(1<<7)
14924528Sfsmp#define BT848_O_SCLOOP_CAGC		(1<<6)
15024528Sfsmp#define BT848_O_SCLOOP_CKILL		(1<<5)
15124528Sfsmp#define BT848_O_SCLOOP_HFILT		(0x3<<3)
15224528Sfsmp# define BT848_O_SCLOOP_HFILT_ICON	(0x3<<3)
15324528Sfsmp# define BT848_O_SCLOOP_HFILT_QCIF	(0x2<<3)
15424528Sfsmp# define BT848_O_SCLOOP_HFILT_CIF	(0x1<<3)
15524528Sfsmp# define BT848_O_SCLOOP_HFILT_AUTO	(0x0<<3)
15624528Sfsmp#define BT848_O_SCLOOP_RSVD0		(0x7<<0)
15724246Sfsmp    int		:32;		/* c4, c5,c6,c7 */
15824246Sfsmp    int		:32;		/* c8, c9,ca,cb */
15924246Sfsmp    BTBYTE (o_vscale_hi);	/* cc, cd,ce,cf */
16024246Sfsmp    BTBYTE (o_vscale_lo);	/* d0, d1,d2,d3 */
16124246Sfsmp    BTBYTE (color_fmt);		/* d4, d5,d6,d7 */
16225329Sfsmp    bregister_t color_ctl_swap		:4; /* d8 */
16324528Sfsmp#define BT848_COLOR_CTL_WSWAP_ODD	(1<<3)
16424528Sfsmp#define BT848_COLOR_CTL_WSWAP_EVEN	(1<<2)
16524528Sfsmp#define BT848_COLOR_CTL_BSWAP_ODD	(1<<1)
16624528Sfsmp#define BT848_COLOR_CTL_BSWAP_EVEN	(1<<0)
16725329Sfsmp    bregister_t color_ctl_gamma		:1;
16825329Sfsmp    bregister_t color_ctl_rgb_ded	:1;
16925329Sfsmp    bregister_t color_ctl_color_bars	:1;
17025329Sfsmp    bregister_t color_ctl_ext_frmrate	:1;
17125329Sfsmp    int		:24;		/* d9,da,db */
17224246Sfsmp    BTBYTE (cap_ctl);		/* dc, dd,de,df */
17324528Sfsmp#define BT848_CAP_CTL_DITH_FRAME	(1<<4)
17424528Sfsmp#define BT848_CAP_CTL_VBI_ODD		(1<<3)
17524528Sfsmp#define BT848_CAP_CTL_VBI_EVEN		(1<<2)
17624528Sfsmp#define BT848_CAP_CTL_ODD		(1<<1)
17724528Sfsmp#define BT848_CAP_CTL_EVEN		(1<<0)
17824246Sfsmp    BTBYTE (vbi_pack_size);	/* e0, e1,e2,e3 */
17924246Sfsmp    BTBYTE (vbi_pack_del);	/* e4, e5,e6,e7 */
18024246Sfsmp    int		:32;		/* e8, e9,ea,eb */
18124246Sfsmp    BTBYTE (o_vtc);		/* ec, ed,ee,ef */
18224246Sfsmp    u_char	filler2[0x100-0xf0];
18324246Sfsmp    BTLONG (int_stat);		/* 100, 101,102,103 */
18424246Sfsmp    BTLONG (int_mask);		/* 104, 105,106,107 */
18524528Sfsmp#define BT848_INT_RISCS			(0xf<<28)
18624528Sfsmp#define BT848_INT_RISC_EN		(1<<27)
18724528Sfsmp#define BT848_INT_RACK			(1<<25)
18824528Sfsmp#define BT848_INT_FIELD			(1<<24)
18924528Sfsmp#define BT848_INT_MYSTERYBIT		(1<<23)
19024528Sfsmp#define BT848_INT_SCERR			(1<<19)
19124528Sfsmp#define BT848_INT_OCERR			(1<<18)
19224528Sfsmp#define BT848_INT_PABORT		(1<<17)
19324528Sfsmp#define BT848_INT_RIPERR		(1<<16)
19424528Sfsmp#define BT848_INT_PPERR			(1<<15)
19524528Sfsmp#define BT848_INT_FDSR			(1<<14)
19624528Sfsmp#define BT848_INT_FTRGT			(1<<13)
19724528Sfsmp#define BT848_INT_FBUS			(1<<12)
19824528Sfsmp#define BT848_INT_RISCI			(1<<11)
19924528Sfsmp#define BT848_INT_GPINT			(1<<9)
20024528Sfsmp#define BT848_INT_I2CDONE		(1<<8)
20124528Sfsmp#define BT848_INT_RSV1			(1<<7)
20224528Sfsmp#define BT848_INT_RSV0			(1<<6)
20324528Sfsmp#define BT848_INT_VPRES			(1<<5)
20424528Sfsmp#define BT848_INT_HLOCK			(1<<4)
20524528Sfsmp#define BT848_INT_OFLOW			(1<<3)
20624528Sfsmp#define BT848_INT_HSYNC			(1<<2)
20724528Sfsmp#define BT848_INT_VSYNC			(1<<1)
20824528Sfsmp#define BT848_INT_FMTCHG		(1<<0)
20924246Sfsmp    int		:32;		/* 108, 109,10a,10b */
21024246Sfsmp    BTWORD (gpio_dma_ctl);	/* 10c, 10d,10e,10f */
21129233Smarkm#define BT848_DMA_CTL_PL23TP4		(0<<6)	/* planar1 trigger 4 */
21229233Smarkm#define BT848_DMA_CTL_PL23TP8		(1<<6)	/* planar1 trigger 8 */
21329233Smarkm#define BT848_DMA_CTL_PL23TP16		(2<<6)	/* planar1 trigger 16 */
21429233Smarkm#define BT848_DMA_CTL_PL23TP32		(3<<6)	/* planar1 trigger 32 */
21529233Smarkm#define BT848_DMA_CTL_PL1TP4		(0<<4)	/* planar1 trigger 4 */
21629233Smarkm#define BT848_DMA_CTL_PL1TP8		(1<<4)	/* planar1 trigger 8 */
21729233Smarkm#define BT848_DMA_CTL_PL1TP16		(2<<4)	/* planar1 trigger 16 */
21829233Smarkm#define BT848_DMA_CTL_PL1TP32		(3<<4)	/* planar1 trigger 32 */
21929233Smarkm#define BT848_DMA_CTL_PKTP4		(0<<2)	/* packed trigger 4 */
22029233Smarkm#define BT848_DMA_CTL_PKTP8		(1<<2)	/* packed trigger 8 */
22129233Smarkm#define BT848_DMA_CTL_PKTP16		(2<<2)	/* packed trigger 16 */
22229233Smarkm#define BT848_DMA_CTL_PKTP32		(3<<2)	/* packed trigger 32 */
22324528Sfsmp#define BT848_DMA_CTL_RISC_EN		(1<<1)
22424528Sfsmp#define BT848_DMA_CTL_FIFO_EN		(1<<0)
22524246Sfsmp    BTLONG (i2c_data_ctl);	/* 110, 111,112,113 */
22624528Sfsmp#define BT848_DATA_CTL_I2CDIV		(0xf<<4)
22724528Sfsmp#define BT848_DATA_CTL_I2CSYNC		(1<<3)
22824528Sfsmp#define BT848_DATA_CTL_I2CW3B		(1<<2)
22924528Sfsmp#define BT848_DATA_CTL_I2CSCL		(1<<1)
23024528Sfsmp#define BT848_DATA_CTL_I2CSDA		(1<<0)
23124246Sfsmp    BTLONG (risc_strt_add);	/* 114, 115,116,117 */
23224246Sfsmp    BTLONG (gpio_out_en);	/* 118, 119,11a,11b */	/* really 24 bits */
23324246Sfsmp    BTLONG (gpio_reg_inp);	/* 11c, 11d,11e,11f */	/* really 24 bits */
23424246Sfsmp    BTLONG (risc_count);	/* 120, 121,122,123 */
23524246Sfsmp    u_char	filler3[0x200-0x124];
23624246Sfsmp    BTLONG (gpio_data);		/* 200, 201,202,203 */	/* really 24 bits */
23724246Sfsmp};
23823599Smarkm
23924528Sfsmptypedef volatile struct bt848_registers* bt848_ptr_t;
24024246Sfsmp
24124246Sfsmp
24224528Sfsmp#if 0
24324528Sfsmp/* force people to be aware of the new struct */
24424528Sfsmp
24524087Sfsmp#define BKTR_DSTATUS			0x000
24624087Sfsmp#define BKTR_IFORM			0x004
24724087Sfsmp#define BKTR_TDEC			0x008
24824087Sfsmp#define BKTR_EVEN_CROP			0x00C
24924087Sfsmp#define BKTR_ODD_CROP			0x08C
25024087Sfsmp#define BKTR_E_VDELAY_LO		0x010
25124087Sfsmp#define BKTR_O_VDELAY_LO		0x090
25224087Sfsmp#define BKTR_E_VACTIVE_LO		0x014
25324087Sfsmp#define BKTR_O_VACTIVE_LO		0x094
25424087Sfsmp#define BKTR_E_DELAY_LO			0x018
25524087Sfsmp#define BKTR_O_DELAY_LO			0x098
25624087Sfsmp#define BKTR_E_HACTIVE_LO		0x01C
25724087Sfsmp#define BKTR_O_HACTIVE_LO		0x09C
25824087Sfsmp#define BKTR_E_HSCALE_HI		0x020
25924087Sfsmp#define BKTR_O_HSCALE_HI		0x0A0
26024087Sfsmp#define BKTR_E_HSCALE_LO		0x024
26124087Sfsmp#define BKTR_O_HSCALE_LO		0x0A4
26224087Sfsmp#define BKTR_BRIGHT			0x028
26324087Sfsmp#define BKTR_E_CONTROL			0x02C
26424087Sfsmp#define BKTR_O_CONTROL			0x0AC
26524087Sfsmp#define BKTR_CONTRAST_LO		0x030
26624087Sfsmp#define BKTR_SAT_U_LO			0x034
26724087Sfsmp#define BKTR_SAT_V_LO			0x038
26824087Sfsmp#define BKTR_HUE			0x03C
26924087Sfsmp#define BKTR_E_SCLOOP			0x040
27024087Sfsmp#define BKTR_O_SCLOOP			0x0C0
27124087Sfsmp#define BKTR_OFORM			0x048
27224087Sfsmp#define BKTR_E_VSCALE_HI		0x04C
27324087Sfsmp#define BKTR_O_VSCALE_HI		0x0CC
27424087Sfsmp#define BKTR_E_VSCALE_LO		0x050
27524087Sfsmp#define BKTR_O_VSCALE_LO		0x0D0
27624087Sfsmp#define BKTR_TEST			0x054
27724087Sfsmp#define BKTR_ADELAY			0x060
27824087Sfsmp#define BKTR_BDELAY			0x064
27924087Sfsmp#define BKTR_ADC			0x068
28024087Sfsmp#define BKTR_E_VTC			0x06C
28124087Sfsmp#define BKTR_O_VTC			0x0EC
28224087Sfsmp#define BKTR_SRESET			0x07C
28324087Sfsmp#define BKTR_COLOR_FMT			0x0D4
28424087Sfsmp#define BKTR_COLOR_CTL			0x0D8
28524087Sfsmp#define BKTR_CAP_CTL			0x0DC
28624087Sfsmp#define BKTR_VBI_PACK_SIZE		0x0E0
28724087Sfsmp#define BKTR_VBI_PACK_DEL		0x0E4
28824087Sfsmp#define BKTR_INT_STAT			0x100
28924087Sfsmp#define BKTR_INT_MASK			0x104
29024087Sfsmp#define BKTR_RISC_COUNT			0x120
29124087Sfsmp#define BKTR_RISC_STRT_ADD		0x114
29224087Sfsmp#define BKTR_GPIO_DMA_CTL		0x10C
29324087Sfsmp#define BKTR_GPIO_OUT_EN		0x118
29424087Sfsmp#define BKTR_GPIO_REG_INP		0x11C
29524087Sfsmp#define BKTR_GPIO_DATA			0x200
29624087Sfsmp#define BKTR_I2C_CONTROL		0x110
29723599Smarkm
29824528Sfsmp#endif /* 0 */
29923599Smarkm
30023599Smarkm/*
30123599Smarkm * device support for onboard tv tuners
30223599Smarkm */
30324528Sfsmp
30424528Sfsmp/* description of the LOGICAL tuner */
30524246Sfsmpstruct TVTUNER {
30624528Sfsmp	int		frequency;
30724528Sfsmp	u_char		chnlset;
30824528Sfsmp	u_char		channel;
30924528Sfsmp	u_char		band;
31024528Sfsmp	u_char		afc;
31133850Sahasty 	u_char		radio_mode;	/* current mode of the radio mode */
31223599Smarkm};
31323599Smarkm
31424528Sfsmp/* description of the PHYSICAL tuner */
31524528Sfsmpstruct TUNER {
31624528Sfsmp	char*		name;
31724528Sfsmp	u_char		type;
31824528Sfsmp	u_char		pllAddr;
31933025Sahasty	u_char		pllControl[4];
32024528Sfsmp	u_char		bandLimits[ 2 ];
32133025Sahasty	u_char		bandAddrs[ 4 ];        /* 3 first for the 3 TV
32233025Sahasty					       ** bands. Last for radio
32333025Sahasty					       ** band (0x00=NoRadio).
32433025Sahasty					       */
32533025Sahasty
32624528Sfsmp};
32724528Sfsmp
32824528Sfsmp/* description of the card */
32924246Sfsmp#define EEPROMBLOCKSIZE		32
33024246Sfsmpstruct CARDTYPE {
33124528Sfsmp	char*			name;
33224528Sfsmp	const struct TUNER*	tuner;
33330856Seivind	u_char			dbx;		/* Has DBX chip? */
33430856Seivind	u_char			msp3400c;	/* Has msp3400c chip? */
33524528Sfsmp	u_char			eepromAddr;
33624528Sfsmp	u_char			eepromSize;	/* bytes / EEPROMBLOCKSIZE */
33724528Sfsmp	u_char			audiomuxs[ 5 ];	/* tuner, ext, int/unused,
33824528Sfsmp						    mute, present */
33924246Sfsmp};
34023599Smarkm
34124528Sfsmpstruct format_params {
34224528Sfsmp  /* Total lines, lines before image, image lines */
34324528Sfsmp  int vtotal, vdelay, vactive;
34424528Sfsmp  /* Total unscaled horizontal pixels, pixels before image, image pixels */
34524528Sfsmp  int htotal, hdelay, hactive;
34638706Ssos  /* Scaled horizontal image pixels, Total Scaled horizontal pixels */
34738706Ssos  int  scaled_hactive, scaled_htotal;
34838706Ssos  /* frame rate . for ntsc is 30 frames per second */
34929233Smarkm  int frame_rate;
35038706Ssos  /* A-delay and B-delay */
35130856Seivind  u_char adelay, bdelay;
35238706Ssos  /* Iform XTSEL value */
35330856Seivind  int iform_xtsel;
35424528Sfsmp};
35524528Sfsmp
35625329Sfsmp
35725329Sfsmptypedef struct bktr_clip bktr_clip_t;
35823599Smarkm/*
35923599Smarkm * BrookTree 848  info structure, one per bt848 card installed.
36023599Smarkm */
36124528Sfsmpstruct bktr_softc {
36229233Smarkm#ifdef __bsdi__
36329233Smarkm    struct device bktr_dev;	/* base device */
36429233Smarkm    struct isadev bktr_id;	/* ISA device */
36529233Smarkm    struct intrhand bktr_ih;	/* interrupt vectoring */
36629233Smarkm#define pcici_t pci_devaddr_t
36729233Smarkm#endif
36824528Sfsmp    bt848_ptr_t base;		/* Bt848 register physical address */
36924246Sfsmp    vm_offset_t phys_base;	/* Bt848 register physical address */
37023599Smarkm    pcici_t	tag;		/* PCI tag, for doing PCI commands */
37123599Smarkm    vm_offset_t bigbuf;		/* buffer that holds the captured image */
37223599Smarkm    int		alloc_pages;	/* number of pages in bigbuf */
37323599Smarkm    struct proc	*proc;		/* process to receive raised signal */
37423599Smarkm    int		signal;		/* signal to send to process */
37536090Sahasty    int		clr_on_start;	/* clear cap buf on capture start? */
37623599Smarkm#define	METEOR_SIG_MODE_MASK	0xffff0000
37723599Smarkm#define	METEOR_SIG_FIELD_MODE	0x00010000
37823599Smarkm#define	METEOR_SIG_FRAME_MODE	0x00000000
37923599Smarkm    vm_offset_t  dma_prog;
38023599Smarkm    vm_offset_t  odd_dma_prog;
38123599Smarkm    char         dma_prog_loaded;
38223599Smarkm    struct meteor_mem *mem;	/* used to control sync. multi-frame output */
38323599Smarkm    u_long	synch_wait;	/* wait for free buffer before continuing */
38423599Smarkm    short	current;	/* frame number in buffer (1-frames) */
38523599Smarkm    short	rows;		/* number of rows in a frame */
38623599Smarkm    short	cols;		/* number of columns in a frame */
38738706Ssos    int		capture_area_x_offset; /* Usually the full 640x480(NTSC) image is */
38838706Ssos    int		capture_area_y_offset; /* captured. The capture area allows for */
38938706Ssos    int		capture_area_x_size;   /* example 320x200 pixels from the centre */
39038706Ssos    int		capture_area_y_size;   /* of the video image to be captured. */
39138706Ssos    char	capture_area_enabled;  /* When TRUE use user's capture area. */
39225329Sfsmp    int		pixfmt;         /* active pixel format (idx into fmt tbl) */
39325329Sfsmp    int		pixfmt_compat;  /* Y/N - in meteor pix fmt compat mode */
39423599Smarkm    u_long	format;		/* frame format rgb, yuv, etc.. */
39523599Smarkm    short	frames;		/* number of frames allocated */
39623599Smarkm    int		frame_size;	/* number of bytes in a frame */
39723599Smarkm    u_long	fifo_errors;	/* number of fifo capture errors since open */
39823599Smarkm    u_long	dma_errors;	/* number of DMA capture errors since open */
39923599Smarkm    u_long	frames_captured;/* number of frames captured since open */
40023599Smarkm    u_long	even_fields_captured; /* number of even fields captured */
40123599Smarkm    u_long	odd_fields_captured; /* number of odd fields captured */
40223599Smarkm    u_long	range_enable;	/* enable range checking ?? */
40323599Smarkm    u_short     capcontrol;     /* reg 0xdc capture control */
40423935Sfsmp    u_short     bktr_cap_ctl;
40529233Smarkm    volatile u_int	flags;
40623599Smarkm#define	METEOR_INITALIZED	0x00000001
40723599Smarkm#define	METEOR_OPEN		0x00000002
40823599Smarkm#define	METEOR_MMAP		0x00000004
40923599Smarkm#define	METEOR_INTR		0x00000008
41023599Smarkm#define	METEOR_READ		0x00000010	/* XXX never gets referenced */
41123599Smarkm#define	METEOR_SINGLE		0x00000020	/* get single frame */
41223599Smarkm#define	METEOR_CONTIN		0x00000040	/* continuously get frames */
41323599Smarkm#define	METEOR_SYNCAP		0x00000080	/* synchronously get frames */
41423599Smarkm#define	METEOR_CAP_MASK		0x000000f0
41523599Smarkm#define	METEOR_NTSC		0x00000100
41623599Smarkm#define	METEOR_PAL		0x00000200
41723599Smarkm#define	METEOR_SECAM		0x00000400
41823599Smarkm#define	METEOR_AUTOMODE		0x00000800
41923599Smarkm#define	METEOR_FORM_MASK	0x00000f00
42023599Smarkm#define	METEOR_DEV0		0x00001000
42123599Smarkm#define	METEOR_DEV1		0x00002000
42223599Smarkm#define	METEOR_DEV2		0x00004000
42323599Smarkm#define	METEOR_DEV3		0x00008000
42423599Smarkm#define METEOR_DEV_SVIDEO	0x00006000
42523599Smarkm#define METEOR_DEV_RGB		0x0000a000
42623599Smarkm#define	METEOR_DEV_MASK		0x0000f000
42723599Smarkm#define	METEOR_RGB16		0x00010000
42823599Smarkm#define	METEOR_RGB24		0x00020000
42923599Smarkm#define	METEOR_YUV_PACKED	0x00040000
43023599Smarkm#define	METEOR_YUV_PLANAR	0x00080000
43123599Smarkm#define	METEOR_WANT_EVEN	0x00100000	/* want even frame */
43223599Smarkm#define	METEOR_WANT_ODD		0x00200000	/* want odd frame */
43323599Smarkm#define	METEOR_WANT_MASK	0x00300000
43423599Smarkm#define METEOR_ONLY_EVEN_FIELDS	0x01000000
43523599Smarkm#define METEOR_ONLY_ODD_FIELDS	0x02000000
43623599Smarkm#define METEOR_ONLY_FIELDS_MASK 0x03000000
43723599Smarkm#define METEOR_YUV_422		0x04000000
43823599Smarkm#define	METEOR_OUTPUT_FMT_MASK	0x040f0000
43923599Smarkm#define	METEOR_WANT_TS		0x08000000	/* time-stamp a frame */
44023599Smarkm#define METEOR_RGB		0x20000000	/* meteor rgb unit */
44123599Smarkm#define METEOR_FIELD_MODE	0x80000000
44224528Sfsmp    u_char	tflags;
44324528Sfsmp#define	TUNER_INITALIZED	0x00000001
44424528Sfsmp#define	TUNER_OPEN		0x00000002
44523599Smarkm    u_short	fps;		/* frames per second */
44623599Smarkm    struct meteor_video video;
44724246Sfsmp    struct TVTUNER	tuner;
44824528Sfsmp    struct CARDTYPE	card;
44924528Sfsmp    u_char		audio_mux_select;	/* current mode of the audio */
45024528Sfsmp    u_char		audio_mute_state;	/* mute state of the audio */
45124528Sfsmp    u_char		format_params;
45225329Sfsmp    u_long              current_sol;
45325329Sfsmp    u_long              current_col;
45425329Sfsmp    int                 clip_start;
45525329Sfsmp    int                 line_length;
45625329Sfsmp    int                 last_y;
45725329Sfsmp    int                 y;
45825329Sfsmp    int                 y2;
45925329Sfsmp    int                 yclip;
46025329Sfsmp    int                 yclip2;
46125329Sfsmp    int                 max_clip_node;
46225329Sfsmp    bktr_clip_t		clip_list[100];
46336090Sahasty    int                 reverse_mute;
46436090Sahasty    int                 bt848_tuner;
46536090Sahasty    int                 bt848_card;
46637611Sahasty    u_long              id;
46724528Sfsmp};
46823599Smarkm
46924528Sfsmptypedef struct bktr_softc bktr_reg_t;
47024528Sfsmptypedef struct bktr_softc* bktr_ptr_t;
47136090Sahasty
47236090Sahasty#define Bt848_MAX_SIGN 16
47336090Sahasty
47436090Sahastystruct bt848_card_sig {
47536090Sahasty  int card;
47636090Sahasty  int tuner;
47736090Sahasty  u_char signature[Bt848_MAX_SIGN];
47836090Sahasty};
479