]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sys/dev/bktr/bktr_core.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / sys / dev / bktr / bktr_core.h
1 /* $FreeBSD$ */
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
52 int             i2cWrite( bktr_ptr_t bktr, int addr, int byte1, int byte2 );
53 int             i2cRead( bktr_ptr_t bktr, int addr );
54
55 void            msp_dpl_reset( bktr_ptr_t bktr, int i2d_addr );
56 unsigned int    msp_dpl_read( bktr_ptr_t bktr, int i2c_addr, unsigned char dev, unsigned int addr );
57 void            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 /* device name for printf */
72 const char *bktr_name(bktr_ptr_t bktr);
73
74 /* Prototypes for attatch and interrupt functions */
75 void    common_bktr_attach( bktr_ptr_t bktr, int unit,
76                         u_long pci_id, u_int rev ); 
77 int     common_bktr_intr( void *arg );
78
79
80 /* Prototypes for open, close, read, mmap and ioctl calls */
81 int     video_open( bktr_ptr_t bktr ); 
82 int     video_close( bktr_ptr_t bktr );
83 int     video_read( bktr_ptr_t bktr, int unit, struct cdev *dev, struct uio *uio );
84 int     video_ioctl( bktr_ptr_t bktr, int unit,
85                         ioctl_cmd_t cmd, caddr_t arg, struct thread* pr );
86
87
88 int     tuner_open( bktr_ptr_t bktr );
89 int     tuner_close( bktr_ptr_t bktr );
90 int     tuner_ioctl( bktr_ptr_t bktr, int unit,
91                         ioctl_cmd_t cmd, caddr_t arg, struct thread* pr );
92
93 int     vbi_open( bktr_ptr_t bktr );
94 int     vbi_close( bktr_ptr_t bktr );
95 int     vbi_read( bktr_ptr_t bktr, struct uio *uio, int ioflag );
96