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