bktr_reg.h revision 23935
1218885Sdim/*
2218885Sdim * Copyright (c) 1995 Mark Tinguely and Jim Lowe
3218885Sdim * All rights reserved.
4218885Sdim *
5218885Sdim * Redistribution and use in source and binary forms, with or without
6218885Sdim * modification, are permitted provided that the following conditions
7218885Sdim * are met:
8218885Sdim * 1. Redistributions of source code must retain the above copyright
9218885Sdim *    notice, this list of conditions and the following disclaimer.
10218885Sdim * 2. Redistributions in binary form must reproduce the above copyright
11218885Sdim *    notice, this list of conditions and the following disclaimer in the
12218885Sdim *    documentation and/or other materials provided with the distribution.
13218885Sdim * 3. All advertising materials mentioning features or use of this software
14218885Sdim *    must display the following acknowledgement:
15218885Sdim *	This product includes software developed by Mark Tinguely and Jim Lowe
16218885Sdim * 4. The name of the author may not be used to endorse or promote products
17218885Sdim *    derived from this software without specific prior written permission.
18218885Sdim *
19218885Sdim * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20218885Sdim * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21218885Sdim * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22218885Sdim * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
23218885Sdim * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24218885Sdim * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25218885Sdim * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26239462Sdim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27218885Sdim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28218885Sdim * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29218885Sdim * POSSIBILITY OF SUCH DAMAGE.
30226633Sdim */
31226633Sdim#ifndef PCI_LATENCY_TIMER
32218885Sdim#define	PCI_LATENCY_TIMER		0x0c	/* pci timer register */
33218885Sdim#endif
34218885Sdim
35218885Sdim/*
36221345Sdim * Definitions for the Philips SAA7116 digital video to pci interface.
37218885Sdim */
38218885Sdim#define	BROOKTREE_848_ID			0x0350109E
39218885Sdim
40218885Sdimtypedef volatile u_int 	breg_t;
41218885Sdim
42218885Sdim
43218885Sdim#define BKTR_DSTATUS                 0x000
44218885Sdim#define BKTR_IFORM                   0x004
45218885Sdim#define BKTR_TDEC                    0x008
46218885Sdim#define BKTR_EVEN_CROP               0x00C
47218885Sdim#define BKTR_ODD_CROP                0x08C
48218885Sdim#define BKTR_E_VDELAY_LO             0x010
49218885Sdim#define BKTR_O_VDELAY_LO             0x090
50226633Sdim#define BKTR_E_VACTIVE_LO            0x014
51218885Sdim#define BKTR_O_VACTIVE_LO            0x094
52218885Sdim#define BKTR_E_DELAY_LO              0x018
53218885Sdim#define BKTR_O_DELAY_LO              0x098
54218885Sdim#define BKTR_E_HACTIVE_LO            0x01C
55218885Sdim#define BKTR_O_HACTIVE_LO            0x09C
56218885Sdim#define BKTR_E_HSCALE_HI             0x020
57218885Sdim#define BKTR_O_HSCALE_HI             0x0A0
58218885Sdim#define BKTR_E_HSCALE_LO             0x024
59218885Sdim#define BKTR_O_HSCALE_LO             0x0A4
60218885Sdim#define BKTR_BRIGHT                  0x028
61218885Sdim#define BKTR_E_CONTROL               0x02C
62218885Sdim#define BKTR_O_CONTROL               0x0AC
63218885Sdim#define BKTR_CONTRAST_LO             0x030
64218885Sdim#define BKTR_SAT_U_LO                0x034
65218885Sdim#define BKTR_SAT_V_LO                0x038
66218885Sdim#define BKTR_HUE                     0x03C
67218885Sdim#define BKTR_E_SCLOOP                0x040
68218885Sdim#define BKTR_O_SCLOOP                0x0C0
69218885Sdim#define BKTR_OFORM                   0x048
70218885Sdim#define BKTR_E_VSCALE_HI             0x04C
71218885Sdim#define BKTR_O_VSCALE_HI             0x0CC
72218885Sdim#define BKTR_E_VSCALE_LO             0x050
73218885Sdim#define BKTR_O_VSCALE_LO             0x0D0
74226633Sdim#define BKTR_TEST                    0x054
75226633Sdim#define BKTR_ADELAY                  0x060
76226633Sdim#define BKTR_BDELAY                  0x064
77226633Sdim#define BKTR_ADC                     0x068
78226633Sdim#define BKTR_E_VTC                   0x06C
79226633Sdim#define BKTR_O_VTC                   0x0EC
80226633Sdim#define BKTR_SRESET                  0x07C
81226633Sdim#define BKTR_COLOR_FMT               0x0D4
82226633Sdim#define BKTR_COLOR_CTL               0x0D8
83226633Sdim#define BKTR_CAP_CTL                 0x0DC
84226633Sdim#define BKTR_VBI_PACK_SIZE           0x0E0
85226633Sdim#define BKTR_VBI_PACK_DEL            0x0E4
86226633Sdim#define BKTR_INT_STAT                0x100
87226633Sdim#define BKTR_INT_MASK                0x104
88226633Sdim#define BKTR_RISC_COUNT              0x120
89226633Sdim#define BKTR_RISC_STRT_ADD           0x114
90226633Sdim#define BKTR_GPIO_DMA_CTL            0x10C
91226633Sdim#define BKTR_GPIO_OUT_EN             0x118
92226633Sdim#define BKTR_GPIO_REG_INP            0x11C
93226633Sdim#define BKTR_GPIO_DATA               0x200
94226633Sdim#define BKTR_I2C_CONTROL             0x110
95226633Sdim
96226633Sdim
97218885Sdim/*
98218885Sdim * device support for onboard tv tuners
99218885Sdim */
100218885Sdimstruct tvtuner {
101218885Sdim	int	frequency;
102218885Sdim	u_char	tunertype;
103218885Sdim	u_char	channel;
104218885Sdim	u_char	band;
105218885Sdim};
106218885Sdim
107221345Sdim
108218885Sdim/*
109218885Sdim * BrookTree 848  info structure, one per bt848 card installed.
110218885Sdim */
111218885Sdimtypedef struct bktr_softc {
112218885Sdim    char *      base;	/* saa7116 register physical address */
113218885Sdim    vm_offset_t phys_base;	/* saa7116 register physical address */
114218885Sdim    pcici_t	tag;		/* PCI tag, for doing PCI commands */
115218885Sdim    vm_offset_t bigbuf;		/* buffer that holds the captured image */
116218885Sdim    int		alloc_pages;	/* number of pages in bigbuf */
117218885Sdim    struct proc	*proc;		/* process to receive raised signal */
118218885Sdim    int		signal;		/* signal to send to process */
119218885Sdim#define	METEOR_SIG_MODE_MASK	0xffff0000
120218885Sdim#define	METEOR_SIG_FIELD_MODE	0x00010000
121218885Sdim#define	METEOR_SIG_FRAME_MODE	0x00000000
122218885Sdim    vm_offset_t  dma_prog;
123218885Sdim    vm_offset_t  odd_dma_prog;
124218885Sdim    char         dma_prog_loaded;
125218885Sdim    struct meteor_mem *mem;	/* used to control sync. multi-frame output */
126218885Sdim    u_long	synch_wait;	/* wait for free buffer before continuing */
127218885Sdim    short	current;	/* frame number in buffer (1-frames) */
128218885Sdim    short	rows;		/* number of rows in a frame */
129218885Sdim    short	cols;		/* number of columns in a frame */
130218885Sdim    short	depth;		/* number of byte per pixel */
131223017Sdim    u_long	format;		/* frame format rgb, yuv, etc.. */
132223017Sdim    short	frames;		/* number of frames allocated */
133223017Sdim    int		frame_size;	/* number of bytes in a frame */
134223017Sdim    u_long	fifo_errors;	/* number of fifo capture errors since open */
135218885Sdim    u_long	dma_errors;	/* number of DMA capture errors since open */
136218885Sdim    u_long	frames_captured;/* number of frames captured since open */
137223017Sdim    u_long	even_fields_captured; /* number of even fields captured */
138218885Sdim    u_long	odd_fields_captured; /* number of odd fields captured */
139218885Sdim    u_long	range_enable;	/* enable range checking ?? */
140218885Sdim    u_short     capcontrol;     /* reg 0xdc capture control */
141218885Sdim    u_short     bktr_cap_ctl;
142218885Sdim    unsigned	flags;
143218885Sdim#define	METEOR_INITALIZED	0x00000001
144218885Sdim#define	METEOR_OPEN		0x00000002
145218885Sdim#define	METEOR_MMAP		0x00000004
146218885Sdim#define	METEOR_INTR		0x00000008
147218885Sdim#define	METEOR_READ		0x00000010	/* XXX never gets referenced */
148218885Sdim#define	METEOR_SINGLE		0x00000020	/* get single frame */
149218885Sdim#define	METEOR_CONTIN		0x00000040	/* continuously get frames */
150218885Sdim#define	METEOR_SYNCAP		0x00000080	/* synchronously get frames */
151218885Sdim#define	METEOR_CAP_MASK		0x000000f0
152218885Sdim#define	METEOR_NTSC		0x00000100
153224145Sdim#define	METEOR_PAL		0x00000200
154218885Sdim#define	METEOR_SECAM		0x00000400
155218885Sdim#define	METEOR_AUTOMODE		0x00000800
156218885Sdim#define	METEOR_FORM_MASK	0x00000f00
157218885Sdim#define	METEOR_DEV0		0x00001000
158218885Sdim#define	METEOR_DEV1		0x00002000
159218885Sdim#define	METEOR_DEV2		0x00004000
160218885Sdim#define	METEOR_DEV3		0x00008000
161218885Sdim#define METEOR_DEV_SVIDEO	0x00006000
162218885Sdim#define METEOR_DEV_RGB		0x0000a000
163218885Sdim#define	METEOR_DEV_MASK		0x0000f000
164218885Sdim#define	METEOR_RGB16		0x00010000
165218885Sdim#define	METEOR_RGB24		0x00020000
166218885Sdim#define	METEOR_YUV_PACKED	0x00040000
167218885Sdim#define	METEOR_YUV_PLANAR	0x00080000
168218885Sdim#define	METEOR_WANT_EVEN	0x00100000	/* want even frame */
169218885Sdim#define	METEOR_WANT_ODD		0x00200000	/* want odd frame */
170218885Sdim#define	METEOR_WANT_MASK	0x00300000
171218885Sdim#define METEOR_ONLY_EVEN_FIELDS	0x01000000
172218885Sdim#define METEOR_ONLY_ODD_FIELDS	0x02000000
173218885Sdim#define METEOR_ONLY_FIELDS_MASK 0x03000000
174218885Sdim#define METEOR_YUV_422		0x04000000
175218885Sdim#define	METEOR_OUTPUT_FMT_MASK	0x040f0000
176218885Sdim#define	METEOR_WANT_TS		0x08000000	/* time-stamp a frame */
177218885Sdim#define METEOR_RGB		0x20000000	/* meteor rgb unit */
178221345Sdim#define METEOR_FIELD_MODE	0x80000000
179221345Sdim    u_short	fps;		/* frames per second */
180221345Sdim#ifdef DEVFS
181221345Sdim    void	*devfs_token;
182221345Sdim#endif
183221345Sdim    struct meteor_video video;
184221345Sdim    struct tvtuner	tuner;
185221345Sdim} bktr_reg_t;
186221345Sdim
187221345Sdim
188221345Sdim