2
* Id: vga.h,v 1.1 1999/11/02 03:54:46 keithp Exp $
4
* Copyright � 1999 Keith Packard
6
* Permission to use, copy, modify, distribute, and sell this software and its
7
* documentation for any purpose is hereby granted without fee, provided that
8
* the above copyright notice appear in all copies and that both that
9
* copyright notice and this permission notice appear in supporting
10
* documentation, and that the name of Keith Packard not be used in
11
* advertising or publicity pertaining to distribution of the software without
12
* specific, written prior permission. Keith Packard makes no
13
* representations about the suitability of this software for any purpose. It
14
* is provided "as is" without express or implied warranty.
16
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22
* PERFORMANCE OF THIS SOFTWARE.
24
/* $XFree86: xc/programs/Xserver/hw/kdrive/vga.h,v 1.4 2000/05/24 23:57:56 keithp Exp $ */
29
typedef unsigned long VGA32;
30
typedef unsigned short VGA16;
31
typedef unsigned char VGA8;
33
typedef volatile VGA8 VGAVOL8;
38
typedef struct _vgaReg {
44
#define VGA_REG_NONE 0xffff
45
#define VGA_REG_END VGA_REG_NONE, 0, 0
47
typedef struct _vgaValue {
53
#define VGA_VALUE_VALID 1 /* value ever fetched */
54
#define VGA_VALUE_MODIFIED 2 /* value ever changed */
55
#define VGA_VALUE_DIRTY 4 /* value needs syncing */
56
#define VGA_VALUE_SAVED 8 /* value preserved */
58
typedef enum _vgaAccess {
59
VgaAccessMem, VgaAccessIo, VgaAccessIndMem, VgaAccessIndIo,
63
typedef struct _vgaMap {
66
VGA8 addr; /* for Ind access; addr offset from port */
67
VGA8 value; /* for Ind access; value offset from port */
68
VGA8 index; /* for Ind access; index value */
71
#define VGA_UNLOCK_FIXED 1 /* dont save current value */
72
#define VGA_UNLOCK_LOCK 2 /* execute only on relock */
73
#define VGA_UNLOCK_UNLOCK 4 /* execute only on unlock */
75
typedef struct _vgaSave {
80
#define VGA_SAVE_END VGA_REG_NONE, VGA_REG_NONE
82
typedef struct _vgaCard {
83
void (*map) (struct _vgaCard *card, VGA16 reg, VgaMap *map, VGABOOL write);
94
VgaOutb (VGA8 v, VGA16 r);
97
VgaReadMemb (VGA32 addr);
100
VgaWriteMemb (VGA8 v, VGA32 addr);
103
VgaSetImm (VgaCard *card, VgaReg *reg, VGA32 value);
106
VgaGetImm (VgaCard *card, VgaReg *reg);
109
VgaSet (VgaCard *card, VgaReg *reg, VGA32 value);
112
VgaGet (VgaCard *card, VgaReg *reg);
115
VgaFlush (VgaCard *card);
118
VgaFill (VgaCard *card, VGA16 low, VGA16 high);
121
VgaPreserve (VgaCard *card);
124
VgaInvalidate (VgaCard *card);
127
VgaRestore (VgaCard *card);
130
VgaFetch (VgaCard *card, VGA16 id);
133
VgaStore (VgaCard *card, VGA16 id, VGA8 value);
136
_VgaFetchInd (VGA16 port, VGA8 reg);
139
_VgaStoreInd (VGA16 port, VGA8 reg, VGA8 value);