]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/bktr/bktr_os.h
MFV r336851:
[FreeBSD/FreeBSD.git] / sys / dev / bktr / bktr_os.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_os : This has all the Operating System dependent code.
10  *
11  */
12
13 /*-
14  * SPDX-License-Identifier: BSD-4-Clause
15  *
16  * 1. Redistributions of source code must retain the 
17  * Copyright (c) 1997 Amancio Hasty, 1999 Roger Hardiman
18  * All rights reserved.
19  *
20  * Redistribution and use in source and binary forms, with or without
21  * modification, are permitted provided that the following conditions
22  * are met:
23  * 1. Redistributions of source code must retain the above copyright
24  *    notice, this list of conditions and the following disclaimer.
25  * 2. Redistributions in binary form must reproduce the above copyright
26  *    notice, this list of conditions and the following disclaimer in the
27  *    documentation and/or other materials provided with the distribution.
28  * 3. All advertising materials mentioning features or use of this software
29  *    must display the following acknowledgement:
30  *      This product includes software developed by Amancio Hasty and
31  *      Roger Hardiman
32  * 4. The name of the author may not be used to endorse or promote products 
33  *    derived from this software without specific prior written permission.
34  *
35  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
36  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
37  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
39  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
40  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
41  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
42  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
43  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
44  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
45  * POSSIBILITY OF SUCH DAMAGE.
46  */
47
48
49 /******************************/
50 /* *** Memory Allocation  *** */
51 /******************************/
52 #if (defined(__FreeBSD__) || defined(__bsdi__))
53 vm_offset_t     get_bktr_mem( int unit, unsigned size );
54 #endif
55
56 #if (defined(__NetBSD__) || defined(__OpenBSD__))
57 vm_offset_t     get_bktr_mem(bktr_ptr_t, bus_dmamap_t *, unsigned size);
58 void            free_bktr_mem(bktr_ptr_t, bus_dmamap_t, vm_offset_t);
59 #endif 
60
61 /************************************/
62 /* *** Interrupt Enable/Disable *** */
63 /************************************/
64 #if defined(__FreeBSD__)
65 #if (__FreeBSD_version >=500000)
66 #define USE_VBIMUTEX
67 #define DECLARE_INTR_MASK(s)    /* no need to declare 's' */
68 #define DISABLE_INTR(s)
69 #define ENABLE_INTR(s)
70 #else
71 #define DECLARE_INTR_MASK(s)    intrmask_t s
72 #define DISABLE_INTR(s)         s=spltty()
73 #define ENABLE_INTR(s)          splx(s)
74 #endif
75 #else
76 #define DECLARE_INTR_MASK(s)    /* no need to declare 's' */
77 #define DISABLE_INTR(s)         disable_intr()
78 #define ENABLE_INTR(s)          enable_intr()
79 #endif
80
81 #ifdef USE_VBIMUTEX
82 #define LOCK_VBI(bktr)          mtx_lock(&bktr->vbimutex)
83 #define UNLOCK_VBI(bktr)        mtx_unlock(&bktr->vbimutex)
84 #else
85 #define LOCK_VBI(bktr)
86 #define UNLOCK_VBI(bktr)
87 #endif