bktr_reg.h revision 24087
1/*
2 * Copyright (c) 1995 Mark Tinguely and Jim Lowe
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 *    must display the following acknowledgement:
15 *	This product includes software developed by Mark Tinguely and Jim Lowe
16 * 4. The name of the author may not be used to endorse or promote products
17 *    derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
23 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31#ifndef PCI_LATENCY_TIMER
32#define	PCI_LATENCY_TIMER		0x0c	/* pci timer register */
33#endif
34
35/*
36 * Definitions for the Philips SAA7116 digital video to pci interface.
37 */
38#define	BROOKTREE_848_ID			0x0350109E
39
40typedef volatile u_int 	breg_t;
41
42
43#define BKTR_DSTATUS			0x000
44# define BT848_DSTATUS_PRES		(1<<7)
45# define BT848_DSTATUS_HLOC		(1<<6)
46# define BT848_DSTATUS_FIELD		(1<<5)
47# define BT848_DSTATUS_NUML		(1<<4)
48# define BT848_DSTATUS_CSEL		(1<<3)
49# define BT848_DSTATUS_LOF		(1<<1)
50# define BT848_DSTATUS_COF		(1<<0)
51#define BKTR_IFORM			0x004
52#define BKTR_TDEC			0x008
53#define BKTR_EVEN_CROP			0x00C
54#define BKTR_ODD_CROP			0x08C
55#define BKTR_E_VDELAY_LO		0x010
56#define BKTR_O_VDELAY_LO		0x090
57#define BKTR_E_VACTIVE_LO		0x014
58#define BKTR_O_VACTIVE_LO		0x094
59#define BKTR_E_DELAY_LO			0x018
60#define BKTR_O_DELAY_LO			0x098
61#define BKTR_E_HACTIVE_LO		0x01C
62#define BKTR_O_HACTIVE_LO		0x09C
63#define BKTR_E_HSCALE_HI		0x020
64#define BKTR_O_HSCALE_HI		0x0A0
65#define BKTR_E_HSCALE_LO		0x024
66#define BKTR_O_HSCALE_LO		0x0A4
67#define BKTR_BRIGHT			0x028
68#define BKTR_E_CONTROL			0x02C
69#define BKTR_O_CONTROL			0x0AC
70#define BKTR_CONTRAST_LO		0x030
71#define BKTR_SAT_U_LO			0x034
72#define BKTR_SAT_V_LO			0x038
73#define BKTR_HUE			0x03C
74#define BKTR_E_SCLOOP			0x040
75#define BKTR_O_SCLOOP			0x0C0
76#define BKTR_OFORM			0x048
77#define BKTR_E_VSCALE_HI		0x04C
78#define BKTR_O_VSCALE_HI		0x0CC
79#define BKTR_E_VSCALE_LO		0x050
80#define BKTR_O_VSCALE_LO		0x0D0
81#define BKTR_TEST			0x054
82#define BKTR_ADELAY			0x060
83#define BKTR_BDELAY			0x064
84#define BKTR_ADC			0x068
85#define BKTR_E_VTC			0x06C
86#define BKTR_O_VTC			0x0EC
87#define BKTR_SRESET			0x07C
88#define BKTR_COLOR_FMT			0x0D4
89#define BKTR_COLOR_CTL			0x0D8
90#define BKTR_CAP_CTL			0x0DC
91#define BKTR_VBI_PACK_SIZE		0x0E0
92#define BKTR_VBI_PACK_DEL		0x0E4
93#define BKTR_INT_STAT			0x100
94#define BKTR_INT_MASK			0x104
95# define BT848_INT_RISCS		(0xf<<28)
96# define BT848_INT_RISC_EN		(1<<27)
97# define BT848_INT_RACK			(1<<25)
98# define BT848_INT_FIELD		(1<<24)
99# define BT848_INT_SCERR		(1<<19)
100# define BT848_INT_OCERR		(1<<18)
101# define BT848_INT_PABORT		(1<<17)
102# define BT848_INT_RIPERR		(1<<16)
103# define BT848_INT_PPERR		(1<<15)
104# define BT848_INT_FDSR			(1<<14)
105# define BT848_INT_FTRGT		(1<<13)
106# define BT848_INT_FBUS			(1<<12)
107# define BT848_INT_RISCI		(1<<11)
108# define BT848_INT_GPINT		(1<<9)
109# define BT848_INT_I2CDONE		(1<<8)
110# define BT848_INT_VPRES		(1<<5)
111# define BT848_INT_HLOCK		(1<<4)
112# define BT848_INT_OFLOW		(1<<3)
113# define BT848_INT_HSYNC		(1<<2)
114# define BT848_INT_VSYNC		(1<<1)
115# define BT848_INT_FMTCHG		(1<<0)
116#define BKTR_RISC_COUNT			0x120
117#define BKTR_RISC_STRT_ADD		0x114
118#define BKTR_GPIO_DMA_CTL		0x10C
119#define BKTR_GPIO_OUT_EN		0x118
120#define BKTR_GPIO_REG_INP		0x11C
121#define BKTR_GPIO_DATA			0x200
122#define BKTR_I2C_CONTROL		0x110
123
124
125/*
126 * device support for onboard tv tuners
127 */
128struct tvtuner {
129	int	frequency;
130	u_char	chnlset;
131	u_char	channel;
132	u_char	band;
133};
134
135
136/*
137 * BrookTree 848  info structure, one per bt848 card installed.
138 */
139typedef struct bktr_softc {
140    char *      base;	/* saa7116 register physical address */
141    vm_offset_t phys_base;	/* saa7116 register physical address */
142    pcici_t	tag;		/* PCI tag, for doing PCI commands */
143    vm_offset_t bigbuf;		/* buffer that holds the captured image */
144    int		alloc_pages;	/* number of pages in bigbuf */
145    struct proc	*proc;		/* process to receive raised signal */
146    int		signal;		/* signal to send to process */
147#define	METEOR_SIG_MODE_MASK	0xffff0000
148#define	METEOR_SIG_FIELD_MODE	0x00010000
149#define	METEOR_SIG_FRAME_MODE	0x00000000
150    vm_offset_t  dma_prog;
151    vm_offset_t  odd_dma_prog;
152    char         dma_prog_loaded;
153    struct meteor_mem *mem;	/* used to control sync. multi-frame output */
154    u_long	synch_wait;	/* wait for free buffer before continuing */
155    short	current;	/* frame number in buffer (1-frames) */
156    short	rows;		/* number of rows in a frame */
157    short	cols;		/* number of columns in a frame */
158    short	depth;		/* number of byte per pixel */
159    u_long	format;		/* frame format rgb, yuv, etc.. */
160    short	frames;		/* number of frames allocated */
161    int		frame_size;	/* number of bytes in a frame */
162    u_long	fifo_errors;	/* number of fifo capture errors since open */
163    u_long	dma_errors;	/* number of DMA capture errors since open */
164    u_long	frames_captured;/* number of frames captured since open */
165    u_long	even_fields_captured; /* number of even fields captured */
166    u_long	odd_fields_captured; /* number of odd fields captured */
167    u_long	range_enable;	/* enable range checking ?? */
168    u_short     capcontrol;     /* reg 0xdc capture control */
169    u_short     bktr_cap_ctl;
170    unsigned	flags;
171#define	METEOR_INITALIZED	0x00000001
172#define	METEOR_OPEN		0x00000002
173#define	METEOR_MMAP		0x00000004
174#define	METEOR_INTR		0x00000008
175#define	METEOR_READ		0x00000010	/* XXX never gets referenced */
176#define	METEOR_SINGLE		0x00000020	/* get single frame */
177#define	METEOR_CONTIN		0x00000040	/* continuously get frames */
178#define	METEOR_SYNCAP		0x00000080	/* synchronously get frames */
179#define	METEOR_CAP_MASK		0x000000f0
180#define	METEOR_NTSC		0x00000100
181#define	METEOR_PAL		0x00000200
182#define	METEOR_SECAM		0x00000400
183#define	METEOR_AUTOMODE		0x00000800
184#define	METEOR_FORM_MASK	0x00000f00
185#define	METEOR_DEV0		0x00001000
186#define	METEOR_DEV1		0x00002000
187#define	METEOR_DEV2		0x00004000
188#define	METEOR_DEV3		0x00008000
189#define METEOR_DEV_SVIDEO	0x00006000
190#define METEOR_DEV_RGB		0x0000a000
191#define	METEOR_DEV_MASK		0x0000f000
192#define	METEOR_RGB16		0x00010000
193#define	METEOR_RGB24		0x00020000
194#define	METEOR_YUV_PACKED	0x00040000
195#define	METEOR_YUV_PLANAR	0x00080000
196#define	METEOR_WANT_EVEN	0x00100000	/* want even frame */
197#define	METEOR_WANT_ODD		0x00200000	/* want odd frame */
198#define	METEOR_WANT_MASK	0x00300000
199#define METEOR_ONLY_EVEN_FIELDS	0x01000000
200#define METEOR_ONLY_ODD_FIELDS	0x02000000
201#define METEOR_ONLY_FIELDS_MASK 0x03000000
202#define METEOR_YUV_422		0x04000000
203#define	METEOR_OUTPUT_FMT_MASK	0x040f0000
204#define	METEOR_WANT_TS		0x08000000	/* time-stamp a frame */
205#define METEOR_RGB		0x20000000	/* meteor rgb unit */
206#define METEOR_FIELD_MODE	0x80000000
207    u_short	fps;		/* frames per second */
208#ifdef DEVFS
209    void	*devfs_token;
210#endif
211    struct meteor_video video;
212    struct tvtuner	tuner;
213    u_char      card_type;		/* brand of card */
214    u_char      audio_mux_select;	/* current mode of the audio */
215    u_char      audio_mute_state;	/* mute state of the audio */
216} bktr_reg_t;
217
218
219