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