Home | History | Annotate | Line # | Download | only in bktr
bktr_core.h revision 1.2.4.1
      1 /*	$NetBSD: bktr_core.h,v 1.2.4.1 2000/07/03 02:19:34 wiz Exp $	*/
      2 
      3 /* FreeBSD: src/sys/dev/bktr/bktr_core.h,v 1.4 2000/06/26 09:41:32 roger Exp */
      4 
      5 /*
      6  * This is part of the Driver for Video Capture Cards (Frame grabbers)
      7  * and TV Tuner cards using the Brooktree Bt848, Bt848A, Bt849A, Bt878, Bt879
      8  * chipset.
      9  * Copyright Roger Hardiman and Amancio Hasty.
     10  *
     11  * bktr_core : This deals with the Bt848/849/878/879 PCI Frame Grabber,
     12  *               Handles all the open, close, ioctl and read userland calls.
     13  *               Sets the Bt848 registers and generates RISC pograms.
     14  *               Controls the i2c bus and GPIO interface.
     15  *               Contains the interface to the kernel.
     16  *               (eg probe/attach and open/close/ioctl)
     17  *
     18  */
     19 
     20 /*
     21  * 1. Redistributions of source code must retain the
     22  * Copyright (c) 1997 Amancio Hasty, 1999 Roger Hardiman
     23  * All rights reserved.
     24  *
     25  * Redistribution and use in source and binary forms, with or without
     26  * modification, are permitted provided that the following conditions
     27  * are met:
     28  * 1. Redistributions of source code must retain the above copyright
     29  *    notice, this list of conditions and the following disclaimer.
     30  * 2. Redistributions in binary form must reproduce the above copyright
     31  *    notice, this list of conditions and the following disclaimer in the
     32  *    documentation and/or other materials provided with the distribution.
     33  * 3. All advertising materials mentioning features or use of this software
     34  *    must display the following acknowledgement:
     35  *      This product includes software developed by Amancio Hasty and
     36  *      Roger Hardiman
     37  * 4. The name of the author may not be used to endorse or promote products
     38  *    derived from this software without specific prior written permission.
     39  *
     40  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     41  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     42  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     43  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
     44  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     45  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     46  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     47  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     48  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
     49  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     50  * POSSIBILITY OF SUCH DAMAGE.
     51  */
     52 
     53 
     54 int		i2cWrite( bktr_ptr_t bktr, int addr, int byte1, int byte2 );
     55 int		i2cRead( bktr_ptr_t bktr, int addr );
     56 
     57 void            msp_dpl_reset( bktr_ptr_t bktr, int i2d_addr );
     58 unsigned int    msp_dpl_read( bktr_ptr_t bktr, int i2c_addr, unsigned char dev, unsigned int addr );
     59 void            msp_dpl_write( bktr_ptr_t bktr, int i2c_addr, unsigned char dev,
     60 			       unsigned int addr, unsigned int data );
     61 
     62 
     63 /*
     64  * Defines for userland processes blocked in this driver
     65  *   For /dev/bktr[n] use memory address of bktr structure
     66  *   For /dev/vbi[n] use memory address of bktr structure + 1
     67  *                   this is ok as the bktr structure is > 1 byte
     68  */
     69 #define BKTR_SLEEP  ((caddr_t)bktr    )
     70 #define VBI_SLEEP   ((caddr_t)bktr + 1)
     71 
     72 
     73 /* device name for printf */
     74 const char *bktr_name(bktr_ptr_t bktr);
     75 
     76 /* Prototypes for attatch and interrupt functions */
     77 void	common_bktr_attach( bktr_ptr_t bktr, int unit,
     78 			u_long pci_id, u_int rev );
     79 int	common_bktr_intr( void *arg );
     80 
     81 
     82 /* Prototypes for open, close, read, mmap and ioctl calls */
     83 int	video_open( bktr_ptr_t bktr );
     84 int	video_close( bktr_ptr_t bktr );
     85 int	video_read( bktr_ptr_t bktr, int unit, dev_t dev, struct uio *uio );
     86 int	video_ioctl( bktr_ptr_t bktr, int unit,
     87 			ioctl_cmd_t cmd, caddr_t arg, struct proc* pr );
     88 
     89 
     90 int	tuner_open( bktr_ptr_t bktr );
     91 int	tuner_close( bktr_ptr_t bktr );
     92 int	tuner_ioctl( bktr_ptr_t bktr, int unit,
     93 			ioctl_cmd_t cmd, caddr_t arg, struct proc* pr );
     94 
     95 int	vbi_open( bktr_ptr_t bktr );
     96 int	vbi_close( bktr_ptr_t bktr );
     97 int	vbi_read( bktr_ptr_t bktr, struct uio *uio, int ioflag );
     98 
     99