2 bttv - Bt848 frame grabber driver
4 bttv's *private* header file -- nobody else than bttv itself
5 should ever include this file.
7 Copyright (C) 1996,97 Ralph Metzler (rjkm@thp.uni-koeln.de)
8 (c) 1999,2000 Gerd Knorr <kraxel@goldbach.in-berlin.de>
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #define BTTV_VERSION_CODE KERNEL_VERSION(0,7,96)
30 #include <linux/types.h>
31 #include <linux/wait.h>
32 #include <linux/i2c.h>
33 #include <linux/i2c-algo-bit.h>
37 #include "audiochip.h"
41 /* ---------------------------------------------------------- */
44 /* insmod options / kernel args */
45 extern int no_overlay;
46 extern unsigned int bttv_verbose;
47 extern unsigned int bttv_debug;
48 extern unsigned int bttv_gpio;
49 extern void bttv_gpio_tracking(struct bttv *btv, char *comment);
50 extern int init_bttv_i2c(struct bttv *btv);
51 extern int pvr_boot(struct bttv *btv);
53 #define dprintk if (bttv_debug) printk
55 /* Anybody who uses more than four? */
57 extern int bttv_num; /* number of Bt848s in use */
58 extern struct bttv bttvs[BTTV_MAX];
62 #define O_NONCAP O_TRUNC
66 # define VBI_MAXLINES 19
68 # define VBI_MAXLINES 16
70 #define VBIBUF_SIZE (2048*VBI_MAXLINES*2)
71 #define MAX_GBUFFERS 64
72 #define RISCMEM_LEN (32744*2)
74 #define BTTV_MAX_FBUF 0x208000
81 ushort swidth, sheight;
90 struct bttv_pll_info {
91 unsigned int pll_ifreq; /* PLL input frequency */
92 unsigned int pll_ofreq; /* PLL output frequency */
93 unsigned int pll_crystal; /* Crystal used for input */
94 unsigned int pll_current; /* Currently programmed ofreq */
99 #define GBUFFER_UNUSED 0
100 #define GBUFFER_GRABBING 1
101 #define GBUFFER_DONE 2
102 #define GBUFFER_ERROR 3
115 struct video_device video_dev;
116 struct video_device radio_dev;
117 struct video_device vbi_dev;
118 struct video_picture picture; /* Current picture params */
119 struct video_audio audio_dev; /* Current audio params */
122 struct semaphore lock;
127 struct i2c_adapter i2c_adap;
128 struct i2c_algo_bit_data i2c_algo;
129 struct i2c_client i2c_client;
130 int i2c_state, i2c_rc;
131 struct i2c_client *i2c_clients[I2C_CLIENTS_MAX];
139 unsigned char revision;
140 unsigned long bt848_adr; /* bus address of IO mem returned by PCI BIOS */
141 unsigned char *bt848_mem; /* pointer to mapped IO memory */
142 unsigned long busriscmem;
145 unsigned char *vbibuf;
146 struct bttv_window win;
148 int type; /* card type */
150 int audio; /* audio mode */
151 int audio_chip; /* set to one of the chips supported by bttv.c */
155 /* miro/pinnacle + Aimslab VHX
156 philips matchbox (tea5757 radio tuner) support */
169 wait_queue_head_t vbiq;
170 wait_queue_head_t capq;
179 struct video_clip *cliprecs;
181 struct bttv_gbuf *gbuf;
182 int gqueue[MAX_GBUFFERS];
183 int gq_in,gq_out,gq_grab,gq_start;
186 struct bttv_pll_info pll;
189 unsigned int last_field; /* number of last grabbed field */
196 wait_queue_head_t gpioq;
198 void (*audio_hook)(struct bttv *btv, struct video_audio *v, int set);
202 #define btwrite(dat,adr) writel((dat), (char *) (btv->bt848_mem+(adr)))
203 #define btread(adr) readl(btv->bt848_mem+(adr))
205 #define btand(dat,adr) btwrite((dat) & btread(adr), adr)
206 #define btor(dat,adr) btwrite((dat) | btread(adr), adr)
207 #define btaor(dat,mask,adr) btwrite((dat) | ((mask) & btread(adr)), adr)
211 #define BTTV_READEE _IOW('v', BASE_VIDIOCPRIVATE+0, char [256])
212 #define BTTV_WRITEE _IOR('v', BASE_VIDIOCPRIVATE+1, char [256])
213 #define BTTV_FIELDNR _IOR('v' , BASE_VIDIOCPRIVATE+2, unsigned int)
214 #define BTTV_PLLSET _IOW('v' , BASE_VIDIOCPRIVATE+3, struct bttv_pll_info)
215 #define BTTV_BURST_ON _IOR('v' , BASE_VIDIOCPRIVATE+4, int)
216 #define BTTV_BURST_OFF _IOR('v' , BASE_VIDIOCPRIVATE+5, int)
217 #define BTTV_VERSION _IOR('v' , BASE_VIDIOCPRIVATE+6, int)
218 #define BTTV_PICNR _IOR('v' , BASE_VIDIOCPRIVATE+7, int)
219 #define BTTV_VBISIZE _IOR('v' , BASE_VIDIOCPRIVATE+8, int)
226 #endif /* _BTTVP_H_ */