ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / drivers / video / sis / osdef.h
1 /* $XFree86$ */
2 /*
3  * OS depending defines
4  *
5  * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
6  *
7  * If distributed as part of the Linux kernel, the following license terms
8  * apply:
9  *
10  * * This program is free software; you can redistribute it and/or modify
11  * * it under the terms of the GNU General Public License as published by
12  * * the Free Software Foundation; either version 2 of the named License,
13  * * or any later version.
14  * *
15  * * This program is distributed in the hope that it will be useful,
16  * * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * * GNU General Public License for more details.
19  * *
20  * * You should have received a copy of the GNU General Public License
21  * * along with this program; if not, write to the Free Software
22  * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
23  *
24  * Otherwise, the following license terms apply:
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: "This product includes
36  * *    software developed by Thomas Winischhofer, Vienna, Austria."
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.
39  * *
40  * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
41  * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
42  * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
43  * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
44  * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45  * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
46  * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
47  * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
48  * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
49  * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
50  *
51  * Author:      Thomas Winischhofer <thomas@winischhofer.net>
52  *              Silicon Integrated Systems, Inc. (used by permission)
53  *
54  */
55
56 /* The choices are: */
57
58 #define LINUX_KERNEL       /* Kernel framebuffer */
59 /* #define LINUX_XF86 */   /* XFree86 */
60
61 /**********************************************************************/
62 #ifdef LINUX_KERNEL  /* -------------------------- */
63 #include <linux/config.h>
64 #include <linux/version.h>
65
66 #ifdef CONFIG_FB_SIS_300
67 #define SIS300
68 #endif
69
70 #ifdef CONFIG_FB_SIS_315
71 #define SIS315H
72 #endif
73
74 #if 1
75 #define SISFBACCEL      /* Include 2D acceleration */
76 #endif
77
78 #endif
79
80 #ifdef LINUX_XF86 /* ----------------------------- */
81 #define SIS300
82 #define SIS315H
83 #endif
84
85 /**********************************************************************/
86 #ifdef LINUX_XF86
87 #define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize)
88 #define SiS_MemoryCopy(Destination,Soruce,Length) memcpy(Destination,Soruce,Length)
89 #endif
90
91 #ifdef LINUX_KERNEL
92 #define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize)
93 #define SiS_MemoryCopy(Destination,Soruce,Length) memcpy(Destination,Soruce,Length)
94 #endif
95
96 /**********************************************************************/
97
98 #ifdef OutPortByte
99 #undef OutPortByte
100 #endif /* OutPortByte */
101
102 #ifdef OutPortWord
103 #undef OutPortWord
104 #endif /* OutPortWord */
105
106 #ifdef OutPortLong
107 #undef OutPortLong
108 #endif /* OutPortLong */
109
110 #ifdef InPortByte
111 #undef InPortByte
112 #endif /* InPortByte */
113
114 #ifdef InPortWord
115 #undef InPortWord
116 #endif /* InPortWord */
117
118 #ifdef InPortLong
119 #undef InPortLong
120 #endif /* InPortLong */
121
122 /**********************************************************************/
123 /*  LINUX XF86                                                        */
124 /**********************************************************************/
125
126 #ifdef LINUX_XF86
127 #define OutPortByte(p,v) outb((CARD16)(p),(CARD8)(v))
128 #define OutPortWord(p,v) outw((CARD16)(p),(CARD16)(v))
129 #define OutPortLong(p,v) outl((CARD16)(p),(CARD32)(v))
130 #define InPortByte(p)    inb((CARD16)(p))
131 #define InPortWord(p)    inw((CARD16)(p))
132 #define InPortLong(p)    inl((CARD16)(p))
133 #endif
134
135 /**********************************************************************/
136 /*  LINUX KERNEL                                                      */
137 /**********************************************************************/
138
139 #ifdef LINUX_KERNEL
140 #define OutPortByte(p,v) outb((u8)(v),(u16)(p))
141 #define OutPortWord(p,v) outw((u16)(v),(u16)(p))
142 #define OutPortLong(p,v) outl((u32)(v),(u16)(p))
143 #define InPortByte(p)    inb((u16)(p))
144 #define InPortWord(p)    inw((u16)(p))
145 #define InPortLong(p)    inl((u16)(p))
146 #endif
147
148