annotate vidix/s3_regs.h @ 30715:f5ecd7dd58e8

10l correct type for =a and =d constraints under x86-32
author zuxy
date Sat, 27 Feb 2010 12:15:02 +0000
parents 0f1b5b68af32
children b11dc6175323
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26972
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
1 /*
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
2 * S3 chipsets registers definition.
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
3 *
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
4 * Copyright (C) 2004 Reza Jelveh
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
5 * Thanks to Alex Deucher for Support
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
6 * Trio/Virge support by Michael Kostylev
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
7 *
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
8 * This file is part of MPlayer.
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
9 *
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
10 * MPlayer is free software; you can redistribute it and/or modify
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
11 * it under the terms of the GNU General Public License as published by
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
13 * (at your option) any later version.
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
14 *
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
15 * MPlayer is distributed in the hope that it will be useful,
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
18 * GNU General Public License for more details.
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
19 *
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
20 * You should have received a copy of the GNU General Public License along
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
21 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
23 */
5b162ba7cee8 vidix s3 headers was missing proper header
ben
parents: 26097
diff changeset
24
26097
74106358c073 Use MPlayer consistent define naming convention for newly introduce
ben
parents: 26096
diff changeset
25 #ifndef MPLAYER_SAVAGE_REGS_H
74106358c073 Use MPlayer consistent define naming convention for newly introduce
ben
parents: 26096
diff changeset
26 #define MPLAYER_SAVAGE_REGS_H
26096
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
27
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
28 #define S3_SAVAGE3D_SERIES(chip) ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE_MX))
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
29 #define S3_SAVAGE4_SERIES(chip) ((chip==S3_SAVAGE4) || (chip==S3_PROSAVAGE))
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
30 #define S3_SAVAGE_MOBILE_SERIES(chip) ((chip==S3_SAVAGE_MX) || (chip==S3_SUPERSAVAGE))
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
31 #define S3_SAVAGE_SERIES(chip) ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE2000))
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
32
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27757
diff changeset
33 /*
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27757
diff changeset
34 * Chip tags. These are used to group the adapters into
26096
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
35 * related families.
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
36 */
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
37 enum S3CHIPTAGS {
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
38 S3_UNKNOWN = 0,
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
39 S3_TRIO64V,
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
40 S3_VIRGE,
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
41 S3_SAVAGE3D,
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
42 S3_SAVAGE_MX,
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
43 S3_SAVAGE4,
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
44 S3_PROSAVAGE,
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
45 S3_SUPERSAVAGE,
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
46 S3_SAVAGE2000,
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
47 S3_LAST
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
48 };
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
49
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
50 #define BIOS_BSIZE 1024
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
51 #define BIOS_BASE 0xc0000
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
52
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
53 #define S3_NEWMMIO_REGBASE 0x1000000 /* 16MB */
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
54 #define S3_NEWMMIO_REGSIZE 0x0010000 /* 64KB */
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
55 #define S3_NEWMMIO_REGSIZE_SAVAGE 0x0080000 /* 512KB */
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
56
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27757
diff changeset
57 #define BASE_FREQ 14.31818
26096
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
58
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
59 /*
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
60 * There are two different streams engines used in the S3 line.
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
61 * The old engine is in the Trio64, Virge,
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
62 * Savage3D, Savage4, SavagePro, and SavageTwister.
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
63 * The new engine is in the Savage2000, SavageMX,
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
64 * SavageIX, and SuperSavage.
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
65 */
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
66
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
67 /* Old engine registers */
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
68 #define PSTREAM_CONTROL_REG 0x8180
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
69 #define COL_CHROMA_KEY_CONTROL_REG 0x8184
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
70 #define SSTREAM_CONTROL_REG 0x8190
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
71 #define CHROMA_KEY_UPPER_BOUND_REG 0x8194
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
72 #define SSTREAM_STRETCH_REG 0x8198
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
73 #define COLOR_ADJUSTMENT_REG 0x819C
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
74 #define BLEND_CONTROL_REG 0x81A0
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
75 #define PSTREAM_FBADDR0_REG 0x81C0
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
76 #define PSTREAM_FBADDR1_REG 0x81C4
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
77 #define PSTREAM_STRIDE_REG 0x81C8
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
78 #define DOUBLE_BUFFER_REG 0x81CC
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
79 #define SSTREAM_FBADDR0_REG 0x81D0
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
80 #define SSTREAM_FBADDR1_REG 0x81D4
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
81 #define SSTREAM_STRIDE_REG 0x81D8
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
82 #define OPAQUE_OVERLAY_CONTROL_REG 0x81DC
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
83 #define K1_VSCALE_REG 0x81E0
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
84 #define SSTREAM_VSCALE_REG 0x81E0
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
85 #define K2_VSCALE_REG 0x81E4
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
86 #define SSTREAM_VINITIAL_REG 0x81E4
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
87 #define DDA_VERT_REG 0x81E8
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
88 #define SSTREAM_LINES_REG 0x81E8
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
89 #define STREAMS_FIFO_REG 0x81EC
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
90 #define PSTREAM_WINDOW_START_REG 0x81F0
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
91 #define PSTREAM_WINDOW_SIZE_REG 0x81F4
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
92 #define SSTREAM_WINDOW_START_REG 0x81F8
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
93 #define SSTREAM_WINDOW_SIZE_REG 0x81FC
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
94 #define FIFO_CONTROL 0x8200
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
95 #define PSTREAM_FBSIZE_REG 0x8300
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
96 #define SSTREAM_FBSIZE_REG 0x8304
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
97 #define SSTREAM_FBADDR2_REG 0x8308
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
98
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
99 /* New engine registers */
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
100 #define PRI_STREAM_FBUF_ADDR0 0x81c0
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
101 #define PRI_STREAM_FBUF_ADDR1 0x81c4
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
102 #define PRI_STREAM_STRIDE 0x81c8
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
103 #define PRI_STREAM_BUFFERSIZE 0x8214
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
104 #define SEC_STREAM_CKEY_LOW 0x8184
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
105 #define SEC_STREAM_CKEY_UPPER 0x8194
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
106 #define BLEND_CONTROL 0x8190
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
107 #define SEC_STREAM_COLOR_CONVERT1 0x8198
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
108 #define SEC_STREAM_COLOR_CONVERT2 0x819c
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
109 #define SEC_STREAM_COLOR_CONVERT3 0x81e4
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
110 #define SEC_STREAM_HSCALING 0x81a0
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
111 #define SEC_STREAM_BUFFERSIZE 0x81a8
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
112 #define SEC_STREAM_HSCALE_NORMALIZE 0x81ac
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
113 #define SEC_STREAM_VSCALING 0x81e8
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
114 #define SEC_STREAM_FBUF_ADDR0 0x81d0
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
115 #define SEC_STREAM_FBUF_ADDR1 0x81d4
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
116 #define SEC_STREAM_FBUF_ADDR2 0x81ec
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
117 #define SEC_STREAM_STRIDE 0x81d8
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
118 #define SEC_STREAM_WINDOW_START 0x81f8
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
119 #define SEC_STREAM_WINDOW_SZ 0x81fc
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
120 #define SEC_STREAM_TILE_OFF 0x821c
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
121 #define SEC_STREAM_OPAQUE_OVERLAY 0x81dc
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
122
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
123 /* Savage 2000 registers */
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
124 #define SEC_STREAM_COLOR_CONVERT0_2000 0x8198
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
125 #define SEC_STREAM_COLOR_CONVERT1_2000 0x819c
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
126 #define SEC_STREAM_COLOR_CONVERT2_2000 0x81e0
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
127 #define SEC_STREAM_COLOR_CONVERT3_2000 0x81e4
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
128
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
129 /* Virge+ registers */
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
130 #define FIFO_CONTROL_REG 0x8200
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
131 #define MIU_CONTROL_REG 0x8204
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
132 #define STREAMS_TIMEOUT_REG 0x8208
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
133 #define MISC_TIMEOUT_REG 0x820c
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
134
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
135 /* VGA stuff */
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
136 #define vgaCRIndex 0x3d4
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
137 #define vgaCRReg 0x3d5
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
138
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
139 /* CRT Control registers */
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
140 #define EXT_MEM_CTRL1 0x53
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
141 #define LIN_ADDR_CTRL 0x58
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
142 #define EXT_MISC_CTRL2 0x67
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
143
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
144 /* Old engine constants */
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
145 #define ENABLE_NEWMMIO 0x08
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
146 #define ENABLE_LFB 0x10
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
147 #define ENABLE_STREAMS_OLD 0x0c
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
148 #define NO_STREAMS_OLD 0xf3
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
149
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
150 /* New engine constants */
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
151 #define ENABLE_STREAM1 0x04
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
152 #define NO_STREAMS 0xF9
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
153
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
154 #define VerticalRetraceWait() \
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
155 do { \
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
156 VGAIN8(0x3d4); \
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
157 VGAOUT8(0x3d4, 0x17); \
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
158 if (VGAIN8(0x3d5) & 0x80) { \
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
159 int i = 0x10000; \
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
160 while ((VGAIN8(0x3da) & 0x08) == 0x08 && i--) ; \
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
161 i = 0x10000; \
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
162 while ((VGAIN8(0x3da) & 0x08) == 0x00 && i--) ; \
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
163 } \
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
164 } while (0)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
165
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
166 /* Scaling operations */
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
167 #define HSCALING_Shift 0
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
168 #define HSCALING_Mask (((1L << 16)-1) << HSCALING_Shift)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
169 #define HSCALING(w0,w1) ((((unsigned int)(((double)w0/(double)w1) * (1 << 15))) << HSCALING_Shift) & HSCALING_Mask)
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27757
diff changeset
170
26096
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
171 #define VSCALING_Shift 0
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
172 #define VSCALING_Mask (((1L << 20)-1) << VSCALING_Shift)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
173 #define VSCALING(h0,h1) ((((unsigned int) (((double)h0/(double)h1) * (1 << 15))) << VSCALING_Shift) & VSCALING_Mask)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
174
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
175 /* Scaling factors */
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
176 #define HDM_SHIFT 16
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
177 #define HDSCALE_4 (2 << HDM_SHIFT)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
178 #define HDSCALE_8 (3 << HDM_SHIFT)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
179 #define HDSCALE_16 (4 << HDM_SHIFT)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
180 #define HDSCALE_32 (5 << HDM_SHIFT)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
181 #define HDSCALE_64 (6 << HDM_SHIFT)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
182
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
183 /* Window parameters */
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
184 #define OS_XY(x,y) (((x+1)<<16)|(y+1))
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
185 #define OS_WH(x,y) (((x-1)<<16)|(y))
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
186
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
187 /* PCI stuff */
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
188
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
189 /* PCI-Memory IO access macros. */
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
190 #define VID_WR08(p,i,val) (((uint8_t *)(p))[(i)]=(val))
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
191 #define VID_RD08(p,i) (((uint8_t *)(p))[(i)])
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
192
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
193 #define VID_WR32(p,i,val) (((uint32_t *)(p))[(i)/4]=(val))
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
194 #define VID_RD32(p,i) (((uint32_t *)(p))[(i)/4])
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
195
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
196 #ifndef USE_RMW_CYCLES
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
197
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
198 /* Can be used to inhibit READ-MODIFY-WRITE cycles. On by default. */
27757
b5a46071062a Replace all occurrences of '__volatile__' and '__volatile' by plain 'volatile'.
diego
parents: 26972
diff changeset
199 #define MEM_BARRIER() __asm__ volatile ("" : : : "memory")
26096
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
200
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
201 #undef VID_WR08
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
202 #define VID_WR08(p,i,val) ({ MEM_BARRIER(); ((uint8_t *)(p))[(i)]=(val); })
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
203 #undef VID_RD08
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
204 #define VID_RD08(p,i) ({ MEM_BARRIER(); ((uint8_t *)(p))[(i)]; })
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
205
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
206 #undef VID_WR16
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
207 #define VID_WR16(p,i,val) ({ MEM_BARRIER(); ((uint16_t *)(p))[(i)/2]=(val); })
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
208 #undef VID_RD16
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
209 #define VID_RD16(p,i) ({ MEM_BARRIER(); ((uint16_t *)(p))[(i)/2]; })
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
210
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
211 #undef VID_WR32
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
212 #define VID_WR32(p,i,val) ({ MEM_BARRIER(); ((uint32_t *)(p))[(i)/4]=(val); })
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
213 #undef VID_RD32
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
214 #define VID_RD32(p,i) ({ MEM_BARRIER(); ((uint32_t *)(p))[(i)/4]; })
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
215 #endif /* USE_RMW_CYCLES */
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
216
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
217 #define VID_AND32(p,i,val) VID_WR32(p,i,VID_RD32(p,i)&(val))
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
218 #define VID_OR32(p,i,val) VID_WR32(p,i,VID_RD32(p,i)|(val))
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
219 #define VID_XOR32(p,i,val) VID_WR32(p,i,VID_RD32(p,i)^(val))
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
220
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
221 #define VGAIN8(addr) VID_RD08(info->control_base+0x8000, addr)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
222 #define VGAIN16(addr) VID_RD16(info->control_base+0x8000, addr)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
223 #define VGAIN(addr) VID_RD32(info->control_base+0x8000, addr)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
224
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
225 #define VGAOUT8(addr,val) VID_WR08(info->control_base+0x8000, addr, val)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
226 #define VGAOUT16(addr,val) VID_WR16(info->control_base+0x8000, addr, val)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
227 #define VGAOUT(addr,val) VID_WR32(info->control_base+0x8000, addr, val)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
228
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
229 #define INREG(addr) VID_RD32(info->control_base, addr)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
230 #define OUTREG(addr,val) VID_WR32(info->control_base, addr, val)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
231 #define INREG8(addr) VID_RD08(info->control_base, addr)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
232 #define OUTREG8(addr,val) VID_WR08(info->control_base, addr, val)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
233 #define INREG16(addr) VID_RD16(info->control_base, addr)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
234 #define OUTREG16(addr,val) VID_WR16(info->control_base, addr, val)
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
235
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
236 #define ALIGN_TO(v, n) (((v) + (n-1)) & ~(n-1))
e6a565ec1a3b New S3 VIDIX driver.
ben
parents:
diff changeset
237
26097
74106358c073 Use MPlayer consistent define naming convention for newly introduce
ben
parents: 26096
diff changeset
238 #endif /* MPLAYER_S3_REGS_H */