151694Sroger/* $FreeBSD$ */
251694Sroger
351694Sroger/*
451694Sroger * This is part of the Driver for Video Capture Cards (Frame grabbers)
551694Sroger * and TV Tuner cards using the Brooktree Bt848, Bt848A, Bt849A, Bt878, Bt879
651694Sroger * chipset.
751694Sroger * Copyright Roger Hardiman and Amancio Hasty.
851694Sroger *
951694Sroger * bktr_core : This deals with the Bt848/849/878/879 PCI Frame Grabber,
1051694Sroger *               Handles all the open, close, ioctl and read userland calls.
1151694Sroger *               Sets the Bt848 registers and generates RISC pograms.
1251694Sroger *               Controls the i2c bus and GPIO interface.
1351694Sroger *               Contains the interface to the kernel.
1451694Sroger *               (eg probe/attach and open/close/ioctl)
1551694Sroger *
1651694Sroger */
1751694Sroger
18139749Simp/*-
1951694Sroger * 1. Redistributions of source code must retain the
2051694Sroger * Copyright (c) 1997 Amancio Hasty, 1999 Roger Hardiman
2151694Sroger * All rights reserved.
2251694Sroger *
2351694Sroger * Redistribution and use in source and binary forms, with or without
2451694Sroger * modification, are permitted provided that the following conditions
2551694Sroger * are met:
2651694Sroger * 1. Redistributions of source code must retain the above copyright
2751694Sroger *    notice, this list of conditions and the following disclaimer.
2851694Sroger * 2. Redistributions in binary form must reproduce the above copyright
2951694Sroger *    notice, this list of conditions and the following disclaimer in the
3051694Sroger *    documentation and/or other materials provided with the distribution.
3151694Sroger * 3. All advertising materials mentioning features or use of this software
3251694Sroger *    must display the following acknowledgement:
3351694Sroger *      This product includes software developed by Amancio Hasty and
3451694Sroger *      Roger Hardiman
3551694Sroger * 4. The name of the author may not be used to endorse or promote products
3651694Sroger *    derived from this software without specific prior written permission.
3751694Sroger *
3851694Sroger * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
3951694Sroger * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
4051694Sroger * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
4151694Sroger * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
4251694Sroger * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
4351694Sroger * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
4451694Sroger * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4551694Sroger * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
4651694Sroger * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
4751694Sroger * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
4851694Sroger * POSSIBILITY OF SUCH DAMAGE.
4951694Sroger */
5051694Sroger
5151694Sroger
5251694Srogerint		i2cWrite( bktr_ptr_t bktr, int addr, int byte1, int byte2 );
5351694Srogerint		i2cRead( bktr_ptr_t bktr, int addr );
5451694Sroger
5552593Srogervoid            msp_dpl_reset( bktr_ptr_t bktr, int i2d_addr );
5652593Srogerunsigned int    msp_dpl_read( bktr_ptr_t bktr, int i2c_addr, unsigned char dev, unsigned int addr );
5752593Srogervoid            msp_dpl_write( bktr_ptr_t bktr, int i2c_addr, unsigned char dev,
5852593Sroger			       unsigned int addr, unsigned int data );
5951694Sroger
6051694Sroger
6151694Sroger/*
6251694Sroger * Defines for userland processes blocked in this driver
6351694Sroger *   For /dev/bktr[n] use memory address of bktr structure
6451694Sroger *   For /dev/vbi[n] use memory address of bktr structure + 1
6551694Sroger *                   this is ok as the bktr structure is > 1 byte
6651694Sroger */
6751694Sroger#define BKTR_SLEEP  ((caddr_t)bktr    )
6851694Sroger#define VBI_SLEEP   ((caddr_t)bktr + 1)
6951694Sroger
7051694Sroger
7162112Sroger/* device name for printf */
7262112Srogerconst char *bktr_name(bktr_ptr_t bktr);
7362112Sroger
7451694Sroger/* Prototypes for attatch and interrupt functions */
7551694Srogervoid	common_bktr_attach( bktr_ptr_t bktr, int unit,
7651694Sroger			u_long pci_id, u_int rev );
7751694Srogerint	common_bktr_intr( void *arg );
7851694Sroger
7951694Sroger
8051694Sroger/* Prototypes for open, close, read, mmap and ioctl calls */
8151694Srogerint	video_open( bktr_ptr_t bktr );
8251694Srogerint	video_close( bktr_ptr_t bktr );
83130585Sphkint	video_read( bktr_ptr_t bktr, int unit, struct cdev *dev, struct uio *uio );
8451694Srogerint	video_ioctl( bktr_ptr_t bktr, int unit,
8583366Sjulian			ioctl_cmd_t cmd, caddr_t arg, struct thread* pr );
8651694Sroger
8751694Sroger
8851694Srogerint	tuner_open( bktr_ptr_t bktr );
8951694Srogerint	tuner_close( bktr_ptr_t bktr );
9051694Srogerint	tuner_ioctl( bktr_ptr_t bktr, int unit,
9183366Sjulian			ioctl_cmd_t cmd, caddr_t arg, struct thread* pr );
9251694Sroger
9351694Srogerint	vbi_open( bktr_ptr_t bktr );
9451694Srogerint	vbi_close( bktr_ptr_t bktr );
9551694Srogerint	vbi_read( bktr_ptr_t bktr, struct uio *uio, int ioflag );
9651694Sroger
97