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
7 * Copyright Roger Hardiman and Amancio Hasty.
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)
19 * SPDX-License-Identifier: BSD-4-Clause
21 * 1. Redistributions of source code must retain the
22 * Copyright (c) 1997 Amancio Hasty, 1999 Roger Hardiman
23 * All rights reserved.
25 * Redistribution and use in source and binary forms, with or without
26 * modification, are permitted provided that the following conditions
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
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.
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.
54 int i2cWrite( bktr_ptr_t bktr, int addr, int byte1, int byte2 );
55 int i2cRead( bktr_ptr_t bktr, int addr );
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 );
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
69 #define BKTR_SLEEP ((caddr_t)bktr )
70 #define VBI_SLEEP ((caddr_t)bktr + 1)
73 /* device name for printf */
74 const char *bktr_name(bktr_ptr_t bktr);
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 );
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, struct cdev *dev, struct uio *uio );
86 int video_ioctl( bktr_ptr_t bktr, int unit,
87 ioctl_cmd_t cmd, caddr_t arg, struct thread* pr );
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 thread* pr );
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 );