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