tcxreg.h revision 1.6 1 1.6 macallan /* $NetBSD: tcxreg.h,v 1.6 2014/07/16 17:58:35 macallan Exp $ */
2 1.2 perry /*
3 1.1 pk * Copyright (c) 1996 The NetBSD Foundation, Inc.
4 1.1 pk * All rights reserved.
5 1.2 perry *
6 1.1 pk * This code is derived from software contributed to The NetBSD Foundation
7 1.1 pk * by Paul Kranenburg.
8 1.2 perry *
9 1.1 pk * Redistribution and use in source and binary forms, with or without
10 1.1 pk * modification, are permitted provided that the following conditions
11 1.1 pk * are met:
12 1.1 pk * 1. Redistributions of source code must retain the above copyright
13 1.1 pk * notice, this list of conditions and the following disclaimer.
14 1.1 pk * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 pk * notice, this list of conditions and the following disclaimer in the
16 1.1 pk * documentation and/or other materials provided with the distribution.
17 1.2 perry *
18 1.1 pk * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 1.1 pk * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 1.1 pk * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 1.1 pk * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 1.1 pk * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 1.1 pk * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 1.1 pk * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 1.1 pk * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 1.1 pk * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 1.1 pk * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 1.1 pk * POSSIBILITY OF SUCH DAMAGE.
29 1.2 perry */
30 1.1 pk
31 1.1 pk /*
32 1.6 macallan * differences between S24 and tcx, as far as this driver is concerned:
33 1.6 macallan * - S24 has 4MB VRAM, 24bit + 2bit control planes, no expansion possible
34 1.6 macallan * - tcx has 1MB VRAM, 8bit, no control planes, may have a VSIMM that bumps
35 1.6 macallan * VRAM to 2MB
36 1.6 macallan * - tcx can apply ROPs to STIP operations, unlike S24
37 1.6 macallan * - tcx has a Bt458 DAC, just like CG6. S24 has an AT&T 20C567
38 1.6 macallan * - the chip itself seems to be (almost) the same, just with different DACs
39 1.6 macallan * and VRAM configuration
40 1.6 macallan */
41 1.6 macallan
42 1.6 macallan /*
43 1.1 pk * A TCX is composed of numerous groups of control registers, all with TLAs:
44 1.1 pk * DHC - ???
45 1.1 pk * TEC - transform engine control?
46 1.1 pk * THC - TEC Hardware Configuration
47 1.1 pk * ROM - a 128Kbyte ROM with who knows what in it.
48 1.6 macallan * STIP - stipple engine, doesn't write attribute bits
49 1.6 macallan * RSTIP - stipple engine, writes attribute bits
50 1.6 macallan * BLIT - blit engine, doesn't copy attribute bits
51 1.6 macallan * RBLIT - blit engine, does copy attribute bits
52 1.1 pk * ALT - ???
53 1.1 pk * colormap - see below
54 1.1 pk * frame buffer memory (video RAM)
55 1.1 pk * possible other stuff
56 1.1 pk *
57 1.6 macallan * RSTIP and RBLIT are set to size zero on my SS4's tcx, they work anyway
58 1.6 macallan * though. No sense using them since tcx has only the lower 8bit planes,
59 1.6 macallan * with no control planes, so there is no actual difference to STIP and
60 1.6 macallan * BLIT ops, and things like qemu and temlib may not actually implement
61 1.6 macallan * them.
62 1.6 macallan * The hardware cursor registers in the THC range are cut off by the size
63 1.6 macallan * attribute but seem to exist, although the parts that display the cursor
64 1.6 macallan * ( the DAC's overlay support ) only exist on the S24.
65 1.6 macallan * At this point I wouldn't be surprised if 8bit tcx actually supports
66 1.6 macallan * the DFB24 and RDFB32 ranges, with the upper planes returning garbage.
67 1.1 pk */
68 1.6 macallan
69 1.1 pk #define TCX_REG_DFB8 0
70 1.1 pk #define TCX_REG_DFB24 1
71 1.1 pk #define TCX_REG_STIP 2
72 1.1 pk #define TCX_REG_BLIT 3
73 1.1 pk #define TCX_REG_RDFB32 4
74 1.1 pk #define TCX_REG_RSTIP 5
75 1.1 pk #define TCX_REG_RBLIT 6
76 1.1 pk #define TCX_REG_TEC 7
77 1.1 pk #define TCX_REG_CMAP 8
78 1.1 pk #define TCX_REG_THC 9
79 1.1 pk #define TCX_REG_ROM 10
80 1.1 pk #define TCX_REG_DHC 11
81 1.1 pk #define TCX_REG_ALT 12
82 1.1 pk
83 1.1 pk #define TCX_NREG 13
84 1.1 pk
85 1.6 macallan /*
86 1.6 macallan * The S24 provides the framebuffer RAM mapped in three ways:
87 1.6 macallan * 26 bits used per pixel, in 32-bit words; the low-order 24 bits are
88 1.6 macallan * blue, green, and red values, and the other two bits select the
89 1.6 macallan * display modes, per pixel);
90 1.6 macallan * 24 bits per pixel, in 32-bit words; the high-order byte reads as
91 1.6 macallan * zero, and is ignored on writes (so the mode bits cannot be altered);
92 1.6 macallan * 8 bits per pixel, unpadded; writes to this space do not modify the
93 1.6 macallan * other 18 bits.
94 1.6 macallan */
95 1.6 macallan #define TCX_CTL_8_MAPPED 0x00000000 /* 8 bits, uses color map */
96 1.6 macallan #define TCX_CTL_24_MAPPED 0x01000000 /* 24 bits, uses color map */
97 1.6 macallan #define TCX_CTL_24_LEVEL 0x03000000 /* 24 bits, ignores color map */
98 1.6 macallan #define TCX_CTL_PIXELMASK 0x00FFFFFF /* mask for index/level */
99 1.6 macallan /*
100 1.6 macallan * The DAC actually supports other bits, for example to select between the
101 1.6 macallan * red and green plane for 8bit output. Not useful here since we can only
102 1.6 macallan * access the red plane as 8bit framebuffer.
103 1.6 macallan */
104 1.1 pk
105 1.1 pk /*
106 1.1 pk * The layout of the THC.
107 1.1 pk */
108 1.1 pk
109 1.5 macallan #define THC_CONFIG 0x00000000
110 1.5 macallan #define THC_SENSEBUS 0x00000080
111 1.5 macallan #define THC_DELAY 0x00000090
112 1.5 macallan #define THC_STRAPPING 0x00000094
113 1.5 macallan #define THC_LINECOUNTER 0x0000009c
114 1.5 macallan #define THC_HSYNC_START 0x000000a0
115 1.5 macallan #define THC_HSYNC_END 0x000000a4
116 1.5 macallan #define THC_HDISP_START 0x000000a8
117 1.5 macallan #define THC_HDISP_VSYNC 0x000000ac
118 1.5 macallan #define THC_HDISP_END 0x000000b0
119 1.5 macallan #define THC_MISC 0x00000818
120 1.5 macallan #define THC_CURSOR_POS 0x000008fc
121 1.5 macallan #define THC_CURSOR_1 0x00000900 /* bitmap bit 1 */
122 1.5 macallan #define THC_CURSOR_0 0x00000980 /* bitmap bit 0 */
123 1.5 macallan
124 1.1 pk /* bits in thc_config ??? */
125 1.1 pk #define THC_CFG_FBID 0xf0000000 /* id mask */
126 1.1 pk #define THC_CFG_FBID_SHIFT 28
127 1.1 pk #define THC_CFG_SENSE 0x07000000 /* sense mask */
128 1.1 pk #define THC_CFG_SENSE_SHIFT 24
129 1.1 pk #define THC_CFG_REV 0x00f00000 /* revision mask */
130 1.1 pk #define THC_CFG_REV_SHIFT 20
131 1.1 pk #define THC_CFG_RST 0x00008000 /* reset */
132 1.1 pk
133 1.1 pk /* bits in thc_hcmisc */
134 1.1 pk #define THC_MISC_OPENFLG 0x80000000 /* open flag (what's that?) */
135 1.1 pk #define THC_MISC_SWERR_EN 0x20000000 /* enable SW error interrupt */
136 1.1 pk #define THC_MISC_VSYNC_LEVEL 0x08000000 /* vsync level when disabled */
137 1.1 pk #define THC_MISC_HSYNC_LEVEL 0x04000000 /* hsync level when disabled */
138 1.1 pk #define THC_MISC_VSYNC_DISABLE 0x02000000 /* vsync disable */
139 1.1 pk #define THC_MISC_HSYNC_DISABLE 0x01000000 /* hsync disable */
140 1.1 pk #define THC_MISC_XXX1 0x00ffe000 /* unused */
141 1.1 pk #define THC_MISC_RESET 0x00001000 /* ??? */
142 1.1 pk #define THC_MISC_XXX2 0x00000800 /* unused */
143 1.1 pk #define THC_MISC_VIDEN 0x00000400 /* video enable */
144 1.1 pk #define THC_MISC_SYNC 0x00000200 /* not sure what ... */
145 1.1 pk #define THC_MISC_VSYNC 0x00000100 /* ... these really are */
146 1.1 pk #define THC_MISC_SYNCEN 0x00000080 /* sync enable */
147 1.1 pk #define THC_MISC_CURSRES 0x00000040 /* cursor resolution */
148 1.1 pk #define THC_MISC_INTEN 0x00000020 /* v.retrace intr enable */
149 1.1 pk #define THC_MISC_INTR 0x00000010 /* intr pending / ack bit */
150 1.1 pk #define THC_MISC_DACWAIT 0x0000000f /* ??? */
151 1.1 pk
152 1.1 pk /*
153 1.1 pk * Partial description of TEC.
154 1.1 pk */
155 1.1 pk struct tcx_tec {
156 1.1 pk u_int tec_config; /* what's in it? */
157 1.1 pk u_int tec_xxx0[35];
158 1.1 pk u_int tec_delay; /* */
159 1.1 pk #define TEC_DELAY_SYNC 0x00000f00
160 1.1 pk #define TEC_DELAY_WR_F 0x000000c0
161 1.1 pk #define TEC_DELAY_WR_R 0x00000030
162 1.1 pk #define TEC_DELAY_SOE_F 0x0000000c
163 1.1 pk #define TEC_DELAY_SOE_S 0x00000003
164 1.1 pk u_int tec_strapping; /* */
165 1.1 pk #define TEC_STRAP_FIFO_LIMIT 0x00f00000
166 1.1 pk #define TEC_STRAP_CACHE_EN 0x00010000
167 1.1 pk #define TEC_STRAP_ZERO_OFFSET 0x00008000
168 1.1 pk #define TEC_STRAP_REFRSH_DIS 0x00004000
169 1.1 pk #define TEC_STRAP_REF_LOAD 0x00001000
170 1.1 pk #define TEC_STRAP_REFRSH_PERIOD 0x000003ff
171 1.1 pk u_int tec_hcmisc; /* */
172 1.1 pk u_int tec_linecount; /* */
173 1.1 pk u_int tec_hss; /* */
174 1.1 pk u_int tec_hse; /* */
175 1.1 pk u_int tec_hds; /* */
176 1.1 pk u_int tec_hsedvs; /* */
177 1.1 pk u_int tec_hde; /* */
178 1.1 pk u_int tec_vss; /* */
179 1.1 pk u_int tec_vse; /* */
180 1.1 pk u_int tec_vds; /* */
181 1.1 pk u_int tec_vde; /* */
182 1.1 pk };
183 1.1 pk
184 1.5 macallan /* DAC registers */
185 1.5 macallan #define DAC_ADDRESS 0x00000000
186 1.5 macallan #define DAC_FB_LUT 0x00000004 /* palette / gamma table */
187 1.5 macallan #define DAC_CONTROL_1 0x00000008
188 1.5 macallan #define DAC_CURSOR_LUT 0x0000000c /* cursor sprite colours */
189 1.5 macallan #define DAC_CONTROL_2 0x00000018
190 1.5 macallan
191 1.5 macallan #define DAC_C1_ID 0
192 1.5 macallan #define DAC_C1_REVISION 1
193 1.5 macallan #define DAC_C1_READ_MASK 4
194 1.5 macallan #define DAC_C1_BLINK_MASK 5
195 1.5 macallan #define DAC_C1_CONTROL_0 6
196