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