1 dawes 1.1 /*
2 * Copyright © 1999 Keith Packard
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Keith Packard not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. Keith Packard makes no
11 * representations about the suitability of this software for any purpose. It
12 * is provided "as is" without express or implied warranty.
13 *
14 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
21 */
|
23 dawes 1.1 /*
24 * Copyright (c) 2004 by The XFree86 Project, Inc.
25 * All rights reserved.
26 *
27 * Permission is hereby granted, free of charge, to any person obtaining
28 * a copy of this software and associated documentation files (the
29 * "Software"), to deal in the Software without restriction, including
30 * without limitation the rights to use, copy, modify, merge, publish,
31 * distribute, sublicense, and/or sell copies of the Software, and to
32 * permit persons to whom the Software is furnished to do so, subject
33 * to the following conditions:
34 *
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions, and the following disclaimer.
37 *
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer
40 * in the documentation and/or other materials provided with the
41 * distribution, and in the same place and form as other copyright,
42 * license and disclaimer information.
43 *
44 dawes 1.1 * 3. The end-user documentation included with the redistribution,
45 * if any, must include the following acknowledgment: "This product
46 * includes software developed by The XFree86 Project, Inc
47 * (http://www.xfree86.org/) and its contributors", in the same
48 * place and form as other third-party acknowledgments. Alternately,
49 * this acknowledgment may appear in the software itself, in the
50 * same form and location as other such third-party acknowledgments.
51 *
52 * 4. Except as contained in this notice, the name of The XFree86
53 * Project, Inc shall not be used in advertising or otherwise to
54 * promote the sale, use or other dealings in this Software without
55 * prior written authorization from The XFree86 Project, Inc.
56 *
57 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
58 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
59 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
60 * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE
61 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
62 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
63 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
64 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
65 dawes 1.1 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
66 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
67 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
68 */
69
70 #ifndef _VGA_H_
71 #define _VGA_H_
72
73 typedef unsigned long VGA32;
74 typedef unsigned short VGA16;
75 typedef unsigned char VGA8;
76 typedef int VGABOOL;
77 typedef volatile VGA8 VGAVOL8;
78
79 #define VGATRUE 1
80 #define VGAFALSE 0
81
82 typedef struct _vgaReg {
83 VGA16 id;
84 VGA8 base;
85 VGA8 len;
86 dawes 1.1 } VgaReg;
87
88 #define VGA_REG_NONE 0xffff
89 #define VGA_REG_END {VGA_REG_NONE, 0, 0}
90
91 typedef struct _vgaValue {
92 VGA8 save;
93 VGA8 cur;
94 VGA16 flags;
95 } VgaValue;
96
97 #define VGA_VALUE_VALID 1 /* value ever fetched */
98 #define VGA_VALUE_MODIFIED 2 /* value ever changed */
99 #define VGA_VALUE_DIRTY 4 /* value needs syncing */
100 #define VGA_VALUE_SAVED 8 /* value preserved */
101
102 typedef enum _vgaAccess {
103 VgaAccessMem, VgaAccessIo, VgaAccessIndMem, VgaAccessIndIo,
104 VgaAccessDone
105 } VgaAccess;
106
107 dawes 1.1 typedef struct _vgaMap {
108 VgaAccess access;
109 VGA32 port;
110 VGA8 addr; /* for Ind access; addr offset from port */
111 VGA8 value; /* for Ind access; value offset from port */
112 VGA8 index; /* for Ind access; index value */
113 } VgaMap;
114
115 #define VGA_UNLOCK_FIXED 1 /* dont save current value */
116 #define VGA_UNLOCK_LOCK 2 /* execute only on relock */
117 #define VGA_UNLOCK_UNLOCK 4 /* execute only on unlock */
118
119 typedef struct _vgaSave {
120 VGA16 first;
121 VGA16 last;
122 } VgaSave;
123
124 #define VGA_SAVE_END {VGA_REG_NONE, VGA_REG_NONE}
125
126 typedef struct _vgaCard {
127 void (*map) (struct _vgaCard *card, VGA16 reg, VgaMap *map, VGABOOL write);
128 dawes 1.1 void *closure;
129 int max;
130 VgaValue *values;
131 VgaSave *saves;
132 } VgaCard;
133
134 VGA8
135 VgaInb (VGA16 r);
136
137 void
138 VgaOutb (VGA8 v, VGA16 r);
139
140 VGA8
141 VgaReadMemb (VGA32 addr);
142
143 void
144 VgaWriteMemb (VGA8 v, VGA32 addr);
145
146 void
147 VgaSetImm (VgaCard *card, VgaReg *reg, VGA32 value);
148
149 dawes 1.1 VGA32
150 VgaGetImm (VgaCard *card, VgaReg *reg);
151
152 void
|
161 dawes 1.1 VGA32
162 VgaGet (VgaCard *card, VgaReg *reg);
163
164 void
165 VgaFlush (VgaCard *card);
166
167 void
168 VgaFinish (VgaCard *card);
169
170 void
171 VgaFill (VgaCard *card, VGA16 low, VGA16 high);
172
173 void
174 VgaPreserve (VgaCard *card);
175
176 void
177 VgaInvalidate (VgaCard *card);
178
179 void
180 VgaRestore (VgaCard *card);
181
182 dawes 1.1 VGA8
183 VgaFetch (VgaCard *card, VGA16 id);
184
185 void
186 VgaStore (VgaCard *card, VGA16 id, VGA8 value);
187
188 VGA8
189 _VgaFetchInd (VGA16 port, VGA8 reg);
190
191 void
192 _VgaStoreInd (VGA16 port, VGA8 reg, VGA8 value);
193
194 #endif /* _VGA_H_ */
|