First import
[xorg_rtime.git] / xorg-server-1.4 / hw / kdrive / r128 / r128.h
blobae9ae03aa6cd1388c43d00bbe9d38801f177932c
1 /*
2 * Copyright © 2003 Anders Carlsson
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 Anders Carlsson not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. Anders Carlsson makes no
11 * representations about the suitability of this software for any purpose. It
12 * is provided "as is" without express or implied warranty.
14 * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL ANDERS CARLSSON 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.
23 #ifndef _R128_H_
24 #define _R128_H_
25 #include <vesa.h>
27 #define R128_REG_BASE(c) ((c)->attr.address[1])
28 #define R128_REG_SIZE(c) (0x4000)
30 #define R128_OUT32(mmio, a, v) (*(VOL32 *) ((mmio) + (a)) = (v))
31 #define R128_IN32(mmio, a) (*(VOL32 *) ((mmio) + (a)))
33 #define R128_REG_GUI_STAT 0x1740
34 #define R128_REG_DEFAULT_OFFSET 0x16e0
35 #define R128_REG_DEFAULT_PITCH 0x16e4
36 #define R128_REG_DP_GUI_MASTER_CNTL 0x146c
37 #define R128_REG_DP_BRUSH_FRGD_CLR 0x147c
38 #define R128_REG_DP_WRITE_MASK 0x16cc
39 #define R128_REG_DP_CNTL 0x16c0
40 #define R128_REG_DST_WIDTH_HEIGHT 0x1598
41 #define R128_REG_DST_Y_X 0x1438
42 #define R128_REG_PC_NGUI_CTLSTAT 0x0184
43 #define R128_REG_DST_HEIGHT_WIDTH 0x143c
44 #define R128_REG_SRC_Y_X 0x1434
45 #define R128_DEFAULT_SC_BOTTOM_RIGHT 0x16e8
46 #define R128_AUX_SC_CNTL 0x1660
47 #define R128_SC_TOP_LEFT 0x16ec
48 #define R128_SC_BOTTOM_RIGHT 0x16f0
50 #define R128_GMC_DST_DATATYPE_SHIFT 8
51 #define R128_GMC_CLR_CMP_CNTL_DIS (1 << 28)
52 #define R128_GMC_AUX_CLIP_DIS (1 << 29)
53 #define R128_GMC_BRUSH_SOLID_COLOR (13 << 4)
54 #define R128_GMC_SRC_DATATYPE_COLOR (3 << 12)
55 #define R128_GMC_ROP3_SHIFT 16
56 #define R128_DST_X_LEFT_TO_RIGHT (1 << 0)
57 #define R128_DST_Y_TOP_TO_BOTTOM (1 << 1)
58 #define R128_GUI_ACTIVE (1 << 31)
59 #define R128_PC_BUSY (1 << 31)
60 #define R128_DP_SRC_SOURCE_MEMORY (2 << 24)
61 #define R128_DEFAULT_SC_RIGHT_MAX (0x1fff << 0)
62 #define R128_DEFAULT_SC_BOTTOM_MAX (0x1fff << 16)
64 typedef volatile CARD8 VOL8;
65 typedef volatile CARD16 VOL16;
66 typedef volatile CARD32 VOL32;
68 typedef struct _r128CardInfo {
69 VesaCardPrivRec vesa;
70 CARD8 *reg_base;
71 int fifo_size;
72 } R128CardInfo;
74 #define getR128CardInfo(kd) ((R128CardInfo *) ((kd)->card->driver))
75 #define r128CardInfo(kd) R128CardInfo *r128c = getR128CardInfo(kd)
77 typedef struct _r128ScreenInfo {
78 VesaScreenPrivRec vesa;
79 CARD8 *screen;
80 CARD8 *off_screen;
81 int off_screen_size;
83 KaaScreenInfoRec kaa;
85 int pitch;
86 int datatype;
88 int dp_gui_master_cntl;
89 } R128ScreenInfo;
91 #define getR128ScreenInfo(kd) ((R128ScreenInfo *) ((kd)->screen->driver))
92 #define r128ScreenInfo(kd) R128ScreenInfo *r128s = getR128ScreenInfo(kd)
94 Bool
95 r128MapReg (KdCardInfo *card, R128CardInfo *r128c);
97 void
98 r128UnmapReg (KdCardInfo *card, R128CardInfo *r128c);
100 void
101 r128SetMMIO (KdCardInfo *card, R128CardInfo *r128c);
103 void
104 r128ResetMMIO (KdCardInfo *card, R128CardInfo *r128c);
106 Bool
107 r128DrawSetup (ScreenPtr pScreen);
109 Bool
110 r128DrawInit (ScreenPtr pScreen);
112 void
113 r128DrawEnable (ScreenPtr pScreen);
115 void
116 r128DrawDisable (ScreenPtr pScreen);
118 void
119 r128DrawFini (ScreenPtr pScreen);
121 extern KdCardFuncs r128Funcs;
123 #endif /* _R128_H_ */