1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
|
/* $NetBSD: igsfbreg.h,v 1.8 2009/11/11 17:01:17 macallan Exp $ */
/*
* Copyright (c) 2002 Valeriy E. Ushakov
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Integraphics Systems IGA 168x and CyberPro series.
* Only tested on IGA 1682 in Krups JavaStation-NC.
*/
#ifndef _DEV_IC_IGSFBREG_H_
#define _DEV_IC_IGSFBREG_H_
/*
* Magic address decoding for memory space accesses in CyberPro.
*/
#define IGS_MEM_MMIO_SELECT 0x00800000 /* memory mapped i/o */
#define IGS_MEM_BE_SELECT 0x00400000 /* endian select */
/*
* Cursor sprite data in linear memory at IGS_EXT_SPRITE_DATA_{LO,HI}.
* 64x64 pixels, 2bpp = 1Kb
*/
#define IGS_CURSOR_DATA_SIZE 1024
/*
* Starting up the chip.
*/
/* Video Enable/Setup */
#define IGS_VDO 0x46e8
#define IGS_VDO_ENABLE 0x08
#define IGS_VDO_SETUP 0x10
/* Video Enable */
#define IGS_VSE 0x102
#define IGS_VSE_ENABLE 0x01
/*
* We map only 32 bytes of actual IGS registers at 0x3c0..0x3df.
* This macro helps to define register names using their "absolute"
* locations - it makes matching defines against docs easier.
*/
#define IGS_REG_BASE 0x3c0
#define IGS_REG_SIZE 0x020
#define IGS_REG_(x) ((x) - IGS_REG_BASE)
/*
* Attribute controller. Flip-flop reset by IGS_INPUT_STATUS1 at 0x3da.
* We don't bother defining actual registers, we only use them once
* during video initialization.
*/
#define IGS_ATTR_IDX IGS_REG_(0x3c0)
#define IGS_ATTR_PORT IGS_REG_(0x3c1)
/*
* Misc output register. We only use the _W register during video
* initialization.
*/
#define IGS_MISC_OUTPUT_W IGS_REG_(0x3c2)
#define IGS_MISC_OUTPUT_R IGS_REG_(0x3cc)
/*
* SEQUENCER.
*/
#define IGS_SEQ_IDX IGS_REG_(0x3c4)
#define IGS_SEQ_PORT IGS_REG_(0x3c5)
#define IGS_SEQ_RESET 0x0
#define IGS_SEQ_RESET_ASYNC 0x01
#define IGS_SEQ_RESET_SYNC 0x02
/* IGS_EXT_SPRITE_CTL/IGS_EXT_SPRITE_DAC_PEL (3cf/56[2]) == 0 */
#define IGS_PEL_MASK IGS_REG_(0x3c6)
/* IGS_EXT_SPRITE_CTL/IGS_EXT_SPRITE_DAC_PEL 3cf/56[2] == 1 */
#define IGS_DAC_CMD IGS_REG_(0x3c6)
/*
* Palette Read/Write: write palette index to the index port.
* Read/write R/G/B in three consecutive accesses to data port.
* After third access to data the index is autoincremented and you can
* proceed with reading/writing data port for the next entry.
*
* When IGS_EXT_SPRITE_DAC_PEL bit in sprite control is set, these
* registers are used to access sprite (i.e. cursor) 2-color palette.
* (NB: apparently, in this mode index autoincrement doesn't work).
*/
#define IGS_DAC_PEL_READ_IDX IGS_REG_(0x3c7)
#define IGS_DAC_PEL_WRITE_IDX IGS_REG_(0x3c8)
#define IGS_DAC_PEL_DATA IGS_REG_(0x3c9)
/*
* GRAPHICS CONTROLLER registers.
*/
#define IGS_GRFX_IDX IGS_REG_(0x3ce)
#define IGS_GRFX_PORT IGS_REG_(0x3cf)
/*
* EXTENDED registers.
*/
#define IGS_EXT_IDX IGS_REG_(0x3ce)
#define IGS_EXT_PORT IGS_REG_(0x3cf)
/* [3..0] -> [19..16] of start addr if IGS_EXT_START_ADDR_ON is set */
#define IGS_EXT_START_ADDR 0x10
#define IGS_EXT_START_ADDR_ON 0x10
/* overflow 10th bits for severl crtc registers; interlaced mode select */
#define IGS_EXT_VOVFL 0x11
#define IGS_EXT_VOVFL_INTERLACED 0x20
#define IGS_EXT_IRQ_CTL 0x12
#define IGS_EXT_IRQ_ENABLE 0x01
/*
* Sync Control.
* Two-bit combinations for h/v:
* 00 - normal, 01 - force 0, 1x - force 1
*/
#define IGS_EXT_SYNC_CTL 0x16
#define IGS_EXT_SYNC_H0 0x01
#define IGS_EXT_SYNC_H1 0x02
#define IGS_EXT_SYNC_V0 0x04
#define IGS_EXT_SYNC_V1 0x08
/*
* For PCI just use normal BAR config.
*/
#define IGS_EXT_BUS_CTL 0x30
#define IGS_EXT_BUS_CTL_LINSIZE_SHIFT 0
#define IGS_EXT_BUS_CTL_LINSIZE_MASK 0x03
#define IGS_EXT_BUS_CTL_LINSIZE(x) \
(((x) >> IGS_EXT_BUS_CTL_LINSIZE_SHIFT) & IGS_EXT_BUS_CTL_LINSIZE_MASK)
/*
* COPREN - enable direct access to coprocessor registers
* COPASELB - select IGS_COP_BASE_B for COP address
*/
#define IGS_EXT_BIU_MISC_CTL 0x33
#define IGS_EXT_BIU_LINEAREN 0x01
#define IGS_EXT_BIU_LIN2MEM 0x02
#define IGS_EXT_BIU_COPREN 0x04
#define IGS_EXT_BIU_COPASELB 0x08
#define IGS_EXT_BIU_SEGON 0x10
#define IGS_EXT_BIU_SEG2MEM 0x20
/*
* Linear Address registers
* PCI: don't write directly, just use nomral PCI configuration
* ISA: only bits [23..20] are programmable, the rest MBZ
*/
#define IGS_EXT_LINA_LO 0x34 /* [3..0] -> [23..20] */
#define IGS_EXT_LINA_HI 0x35 /* [7..0] -> [31..24] */
/* Hardware cursor on-screen location and hot spot */
#define IGS_EXT_SPRITE_HSTART_LO 0x50
#define IGS_EXT_SPRITE_HSTART_HI 0x51 /* bits [2..0] */
#define IGS_EXT_SPRITE_HPRESET 0x52 /* bits [5..0] */
#define IGS_EXT_SPRITE_VSTART_LO 0x53
#define IGS_EXT_SPRITE_VSTART_HI 0x54 /* bits [2..0] */
#define IGS_EXT_SPRITE_VPRESET 0x55 /* bits [5..0] */
/* Hardware cursor control */
#define IGS_EXT_SPRITE_CTL 0x56
#define IGS_EXT_SPRITE_VISIBLE 0x01
#define IGS_EXT_SPRITE_64x64 0x02
#define IGS_EXT_SPRITE_DAC_PEL 0x04
/* bits unrelated to sprite control */
#define IGS_EXT_COP_RESET 0x08
/* Extended graphics mode */
#define IGS_EXT_GRFX_MODE 0x57
#define IGS_EXT_GRFX_MODE_EXT 0x01
/* Overscan R/G/B registers */
#define IGS_EXT_OVERSCAN_RED 0x58
#define IGS_EXT_OVERSCAN_GREEN 0x59
#define IGS_EXT_OVERSCAN_BLUE 0x5a
/* Memory controller */
#define IGS_EXT_MEM_CTL0 0x70
#define IGS_EXT_MEM_CTL1 0x71
#define IGS_EXT_MEM_CTL2 0x72
/*
* SEQ miscellaneous: number of SL between CCLK - controls visual depth.
* These values are for MODE256 == 1, SRMODE = 1 in GRFX/5 mode register.
*/
#define IGS_EXT_SEQ_MISC 0x77
#define IGS_EXT_SEQ_IBM_STD 0
#define IGS_EXT_SEQ_8BPP 1 /* 256 indexed */
#define IGS_EXT_SEQ_16BPP 2 /* HiColor 16bpp, 5-6-5 */
#define IGS_EXT_SEQ_32BPP 3 /* TrueColor 32bpp */
#define IGS_EXT_SEQ_24BPP 4 /* TrueColor 24bpp */
#define IGS_EXT_SEQ_15BPP 6 /* HiColor 16bpp, 5-5-5 */
/* Hardware cursor data location in linear memory */
#define IGS_EXT_SPRITE_DATA_LO 0x7e
#define IGS_EXT_SPRITE_DATA_HI 0x7f /* bits [3..0] */
#define IGS_EXT_VCLK0 0xb0 /* mult */
#define IGS_EXT_VCLK1 0xb1 /* div */
#define IGS_EXT_MCLK0 0xb2 /* mult */
#define IGS_EXT_MCLK1 0xb3 /* div */
/* ----8<---- end of IGS_EXT registers ----8<---- */
/*
* CRTC can be at 0x3b4/0x3b5 (mono) or 0x3d4/0x3d5 (color)
* controlled by bit 0 in misc output register (r=0x3cc/w=0x3c2).
* We forcibly init it to color.
*/
#define IGS_CRTC_IDX IGS_REG_(0x3d4)
#define IGS_CRTC_PORT IGS_REG_(0x3d5)
/*
* Reading this register resets flip-flop at 0x3c0 (attribute
* controller) to address register.
*/
#define IGS_INPUT_STATUS1 IGS_REG_(0x3da)
/*********************************************************************
* IGS Graphic Coprocessor
*/
/*
* Coprocessor registers location in I/O space.
* Controlled by COPASELB bit in IGS_EXT_BIU_MISC_CTL.
*/
#define IGS_COP_BASE_A 0xaf000 /* COPASELB == 0 */
#define IGS_COP_BASE_B 0xbf000 /* COPASELB == 1 */
#define IGS_COP_SIZE 0x00400
/*
* NB: Loaded width values should be 1 less than the actual width!
*/
/*
* Coprocessor control.
*/
#define IGS_COP_CTL_REG 0x011
#define IGS_COP_CTL_HBRDYZ 0x01
#define IGS_COP_CTL_HFEMPTZ 0x02
#define IGS_COP_CTL_CMDFF 0x04
#define IGS_COP_CTL_SOP 0x08 /* rw */
#define IGS_COP_CTL_OPS 0x10
#define IGS_COP_CTL_TER 0x20 /* rw */
#define IGS_COP_CTL_HBACKZ 0x40
#define IGS_COP_CTL_BUSY 0x80
/*
* Source(s) and destination widths.
* 16 bit registers. Only bits [11..0] are used.
*/
#define IGS_COP_SRC_MAP_WIDTH_REG 0x018
#define IGS_COP_SRC2_MAP_WIDTH_REG 0x118
#define IGS_COP_DST_MAP_WIDTH_REG 0x218
/*
* Bitmap depth.
*/
#define IGS_COP_MAP_FMT_REG 0x01c
#define IGS_COP_MAP_8BPP 0x00
#define IGS_COP_MAP_16BPP 0x01
#define IGS_COP_MAP_24BPP 0x02
#define IGS_COP_MAP_32BPP 0x03
/*
* Binary operations are defined below. S - source, D - destination,
* N - not; a - and, o - or, x - xor.
*
* For ternary operations, foreground mix function is one of 256
* ternary raster operations defined by Win32 API; background mix is
* ignored.
*/
#define IGS_COP_FG_MIX_REG 0x048
#define IGS_COP_BG_MIX_REG 0x049
#define IGS_COP_MIX_0 0x0
#define IGS_COP_MIX_SaD 0x1
#define IGS_COP_MIX_SaND 0x2
#define IGS_COP_MIX_S 0x3
#define IGS_COP_MIX_NSaD 0x4
#define IGS_COP_MIX_D 0x5
#define IGS_COP_MIX_SxD 0x6
#define IGS_COP_MIX_SoD 0x7
#define IGS_COP_MIX_NSaND 0x8
#define IGS_COP_MIX_SxND 0x9
#define IGS_COP_MIX_ND 0xa
#define IGS_COP_MIX_SoND 0xb
#define IGS_COP_MIX_NS 0xc
#define IGS_COP_MIX_NSoD 0xd
#define IGS_COP_MIX_NSoND 0xe
#define IGS_COP_MIX_1 0xf
/*
* Foreground/background colours (24 bit).
* Selected by bits in IGS_COP_PIXEL_OP_3_REG.
*/
#define IGS_COP_FG_REG 0x058
#define IGS_COP_BG_REG 0x05C
/*
* Horizontal/vertical dimensions of pixel blit function.
* 16 bit registers. Only [11..0] are used.
*/
#define IGS_COP_WIDTH_REG 0x060
#define IGS_COP_HEIGHT_REG 0x062
/*
* Only bits [21..0] are used.
*/
#define IGS_COP_SRC_BASE_REG 0x070 /* only for 24bpp Src Color Tiling */
#define IGS_COP_SRC_START_REG 0x170
#define IGS_COP_SRC2_START_REG 0x174
#define IGS_COP_DST_START_REG 0x178
/*
* Destination phase angle for 24bpp.
*/
#define IGS_COP_DST_X_PHASE_REG 0x078
#define IGS_COP_DST_X_PHASE_MASK 0x07
/*
* Pixel operation: Direction and draw mode.
* When an octant bit is set, that axis is traversed backwards.
*/
#define IGS_COP_PIXEL_OP_0_REG 0x07c
#define IGS_COP_OCTANT_Y_NEG 0x02 /* 0: top down, 1: bottom up */
#define IGS_COP_OCTANT_X_NEG 0x04 /* 0: l2r, 1: r2l */
#define IGS_COP_DRAW_ALL 0x00
#define IGS_COP_DRAW_FIRST_NULL 0x10
#define IGS_COP_DRAW_LAST_NULL 0x20
/*
* Pixel operation: Pattern operation.
*/
#define IGS_COP_PIXEL_OP_1_REG 0x07d
#define IGS_COP_PPM_TEXT 0x10
#define IGS_COP_PPM_TILE 0x20
#define IGS_COP_PPM_LINE 0x30
#define IGS_COP_PPM_TRANSPARENT 0x40 /* "or" with one of the above */
#define IGS_COP_PPM_FIXED_FG 0x80
#define IGS_COP_PPM_SRC_COLOR_TILE 0x90
/*
* Pixel operation: Host CPU access (host blit) to graphics engine.
*/
#define IGS_COP_PIXEL_OP_2_REG 0x07e
#define IGS_COP_HBLTR 0x01 /* enable read from engine */
#define IGS_COP_HBLTW 0x02 /* enable write to engine */
/*
* Pixel operation: Operation function of graphic engine.
*/
#define IGS_COP_PIXEL_OP_3_REG 0x07f
#define IGS_COP_OP_STROKE 0x04 /* short stroke */
#define IGS_COP_OP_LINE 0x05 /* bresenham line draw */
#define IGS_COP_OP_PXBLT 0x08 /* pixel blit */
#define IGS_COP_OP_PXBLT_INV 0x09 /* invert pixel blit */
#define IGS_COP_OP_PXBLT_3 0x0a /* ternary pixel blit */
/* select fg/bg source: 0 - fg/bg color reg, 1 - src1 map */
#define IGS_COP_OP_FG_FROM_SRC 0x20
#define IGS_COP_OP_BG_FROM_SRC 0x80
#define IGS_CLOCK_REF 14318 /*24576*/ /* KHz */
#define IGS_SCALE(p) ((p) ? (2 * (p)) : 1)
#define IGS_CLOCK(m,n,p) \
((IGS_CLOCK_REF * ((m) + 1)) / (((n) + 1) * IGS_SCALE(p)))
#define IGS_MAX_CLOCK 260000
#define IGS_MIN_VCO 115000
#endif /* _DEV_IC_IGSFBREG_H_ */
|