summaryrefslogtreecommitdiffstats
path: root/private/ntos/nthals/halacr/mips/hm.h
blob: a534ac4a4ae4678b2ff9b293e2011ea4d2a22607 (plain) (blame)
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
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
/*++

Copyright (c) 1994  NeTpower, Inc.
Copyright (c) 1992  Pellucid, inc.

Module Name:

    hm.h

Abstract:

    Hm board register definitions.

Environment:

    Kernel mode

Revision History:

--*/

#ifndef __HM_H__
#define __HM_H__


//
// Addresses used for accessing hardware.
//

#define PEL_GFX1_PBASE       0x40000000
#define PEL_GFX1_SIZE        0x01100000

//
// Define for write buffer flushing.
//
#define FLUSHIO()

//
// Cursor chip registers.
//

typedef struct
{
    volatile ULONG jAddressLo;      // Address low
    volatile ULONG jAddressHi;      // Address high
    volatile ULONG jGlyph;          // Glyph data
    volatile ULONG jControl;        // Control
}
CURSOR, * PCURSOR;

//
// Control register offsets.
//

#define CURS_CMD            0
#define CURS_XLO            1
#define CURS_XHI            2
#define CURS_YLO            3
#define CURS_YHI            4
#define CURS_WINXLO         5
#define CURS_WINXHI         6
#define CURS_WINYLO         7
#define CURS_WINYHI         8
#define CURS_WINWLO         9
#define CURS_WINWHI         10
#define CURS_WINHLO         11
#define CURS_WINHHI         12

//
// Cursor chip commands.
//

#define CURS_BLOCK          0x40
#define CURS_CROSS          0x20
#define CURS_FMT            0x01
#define CURS_1TO1MUX        0x00
#define CURS_4TO1MUX        0x04
#define CURS_5TO1MUX        0x08

//
// Cursor offsets for different monitor types.
//

#define CURS_XHOTOFF        31
#define CURS_YHOTOFF        32
#define CURS_XOFF_60HZ      221
#define CURS_YOFF_60HZ      998
#define CURS_XOFF_30HZ      39
#define CURS_YOFF_30HZ      18
#define CURS_XOFF_NTSC      25
#define CURS_YOFF_NTSC      437
#define CURS_XOFF_PAL       57
#define CURS_YOFF_PAL       535

//
// RAMDAC registers.
//

typedef struct
{
    volatile ULONG jRamDacAddress;  // RAMDAC address;
    volatile ULONG jPalette;        // Color palette RAM
    volatile ULONG jData;           // Data register for RAMDAC address
    volatile ULONG jOverlayPalette; // Overlay palette RAM
}
RAMDAC, * PRAMDAC;

//
// RAMDAC definitions.
//

#define DAC_READMASK        0x04
#define DAC_BLINKMASK       0x05
#define DAC_CMD             0x06
#define DAC_TEST            0x07

//
// DAC command bit definitions.
//

#define DAC_5TO1MUX         0x80
#define DAC_PALENABLE       0x40
#define DAC_BLINK0          0x00
#define DAC_BLINK1          0x10
#define DAC_BLINK2          0x20
#define DAC_BLINK3          0x30
#define DAC_OL1BLINKENABLE  0x08
#define DAC_OL0BLINKENABLE  0x04
#define DAC_OL1ENABLE       0x02
#define DAC_OL0ENABLE       0x01

#define CURSOR_WIDTH        32
#define CURSOR_HEIGHT       32
#define CURSOR_MAXIMUM      ((CURSOR_WIDTH / 8) * CURSOR_HEIGHT)

//
// Offsets within the graphics space.
//

#define HM_RGB_LINEAR   0x00000000
#define HM_REG_OFF      0x01000000
#define HM_RGB_Y0       (HM_REG_OFF + 0x00000000)
#define HM_RGB_Y1       (HM_REG_OFF + 0x00010000)
#define HM_BLK_Y0       (HM_REG_OFF + 0x00020000)
#define HM_BLK_Y1       (HM_REG_OFF + 0x00030000)
#define HM_BLTLOAD_Y0   (HM_REG_OFF + 0x00040000)
#define HM_BLTLOAD_Y1   (HM_REG_OFF + 0x00050000)
#define HM_BLTSTORE_Y0  (HM_REG_OFF + 0x00060000)
#define HM_BLTSTORE_Y1  (HM_REG_OFF + 0x00070000)
#define HM_BT457        (HM_REG_OFF + 0x00080000)
#define HM_BT431        (HM_REG_OFF + 0x00090000)
#define HM_COLOR        (HM_REG_OFF + 0x000A0000)
#define HM_WRITEMASK    (HM_REG_OFF + 0x000B0000)
#define HM_Y0           (HM_REG_OFF + 0x000C0000)
#define HM_Y1           (HM_REG_OFF + 0x000C0004)
#define HM_GENERAL      (HM_REG_OFF + 0x000D0000)
#define HM_VIDTIM       (HM_REG_OFF + 0x000E0000)
#define HM_CLRINTR      (HM_REG_OFF + 0x000F0000)

// general control/status bit assignments

#define G_REDLANE       0x00000003
#define G_GRNLANE       0x0000000C
#define G_BLULANE       0x00000030
#define G_MODE1280      0x00000040      /* 1=1280/1024, 0=1024/768 */
#define G_FASTREF       0x00000080      /* always 0 */
#define G_MASKVINTR     0x00000100      /* 0=vertical retrace intr enabled */
#define G_VGAPASS       0x00000200      /* 1 = VGA passthrough enabled */
#define G_RST439        0x00000400      /* 0 = reset BT439 chip */
#define G_SYNCPOL       0x00000800      /* 0 = active high, 1 = active low */
#define G_UCTRL2        0x00001000      /* unused */
#define G_SEL1          0x00002000      /* ICD2062 SEL1 pin */
#define G_SEL0          0x00004000      /* ICD2062 SEL0 pin */
#define G_NOSYNCGRN     0x00008000      /* 1 = disable sync on green channel */
#define G_BLKSENSE      0x00010000      /* ??? */
#define G_WAIT2         0x00020000      /* 1 = 0 wait states */
#define G_WAIT3         0x00040000      /* 1 = 1 wait state */
#define G_IRQSEL1       0x00080000      /* IRQSEL[1:0]  11 = IRQ 7   10 = IRQ 11
#define G_IRQSEL0       0x00100000      /*              01 = IRQ 10  00 = IRQ 9(2)
#define G_RAWINTR       0x00200000      /* raw value of vertical interrupt */
#define G_USTAT1        0x00400000      /* unused */
#define G_USTAT0        0x00800000      /* ICD2062 ERR* pin */

//
// Define the write-only Control Port (Port 1) bits.
//

#define CP_PORT_EN          0x01 // Port enable - enable this port if = 1.
#define CP_HUE_EN           0x02 // HUE-1 enable - enable the HUE ASIC if = 1.
#define CP_NVRAM_CLK        0x04 // NVRAM clock (sk) signal.
#define CP_NVRAM_EN         0x08 // NVRAM enable (cs) signal.
#define CP_NVRAM_DATA       0x10 // NVRAM data out (do) signal.
#define CP_HIRES_EN         0x20 // Hi-Resolution enable - goto hires if = 1.

//
// Define the read-only Status Port (Port 0 or 1) bits.
//

#define SP_SIGNATURE_MASK   0x0F // Signature mask.
#define SP_SIGNATURE        0x0A // Signature (4 bits).
#define SP_NVRAM_DATA       0x10 // NVRAM di (data in) signal.
#define SP_HIRES_EN         0x20 // Hi-resolution enable - goto hires if = 1.
#define SP_PORT_SEL_MASK    0xC0 // I/O port select lines
#define SP_PORT_SEL_0       0x00 //   00 = Port Choice 0 = 0538h-0539h.
#define SP_PORT_SEL_1       0x40 //   40 = Port Choice 1 = 0E88h-0E89h.
#define SP_PORT_SEL_2       0x80 //   80 = Port Choice 2 = 0F48h-0F49h.
#define SP_PORT_SEL_3       0xC0 //   C0 = Port Choice 3 = 060Ch-060Dh.


//
// Define device extension structure.
//

typedef struct _HW_DEVICE_EXTENSION
{
    PHYSICAL_ADDRESS PhysicalGraphicsAddress0;
    ULONG   GraphicsLength0;

    USHORT  HorizontalResolution;
    USHORT  HorizontalScreenSize;
    USHORT  VerticalResolution;
    USHORT  VerticalScreenSize;

    ULONG   fxVBase;
    ULONG   NumAvailableModes;
    ULONG   iCurrentMode;

    PVOID   VideoAddress;
}
HW_DEVICE_EXTENSION, *PHW_DEVICE_EXTENSION;

//
// This is the mode structure definitions.
//

// temporary - 3/9/93 - roey - used to hardcode certain values

#define HM_GFX_IRQ      11          // vertical retrace IRQ
#define HM_GFX_IRQ_SEL  G_IRQSEL1   // GENERAL REG IRQ select lines
				    // IRQ 11 : sel1 = 1, sel0 = 0
#define HM_MAPPING_PORT ((PUCHAR)0x538)  // The framebuffer mapping I/O port.
#define HM_CONTROL_PORT ((PUCHAR)0x539)  // The control I/O port.

typedef struct _VIDEO_MODE_INFORMATION {
    ULONG Length;
    ULONG ModeIndex;
    ULONG VisScreenWidth;
    ULONG VisScreenHeight;
    ULONG ScreenStride;
    ULONG NumberOfPlanes;
    ULONG BitsPerPlane;
    ULONG Frequency;
    ULONG XMillimeter;
    ULONG YMillimeter;
    ULONG NumberRedBits;
    ULONG NumberGreenBits;
    ULONG NumberBlueBits;
    ULONG RedMask;
    ULONG GreenMask;
    ULONG BlueMask;
    ULONG AttributeFlags;
    ULONG VideoMemoryBitmapWidth;
    ULONG VideoMemoryBitmapHeight;
} VIDEO_MODE_INFORMATION, *PVIDEO_MODE_INFORMATION;

typedef struct {
    ULONG   mClkData,
	    vClkData;
} MVPG_ICD2062;

typedef MVPG_ICD2062 *PMVPG_ICD2062;

typedef struct {
    ULONG   hBlankOn,
	    hBlankOff,
	    hSyncOn,
	    hSyncOff,
	    vBlankOn,
	    vBlankOff,
	    vSyncOn,
	    vSyncOff;
} MVPG_TIMINGS;

typedef MVPG_TIMINGS *PMVPG_TIMINGS;

typedef struct {
    UCHAR                   szModeName[32];
    VIDEO_MODE_INFORMATION  VideoModeInformation;
    MVPG_TIMINGS            mvpgTimings;
    MVPG_ICD2062            mvpgIcd2062;
    ULONG                   mvpgGeneralRegister;
    ULONG                   Bt457CommandReg;

} MVPG_MODE;

typedef MVPG_MODE *PMVPG_MODE;

BOOLEAN HmInitHw(PHW_DEVICE_EXTENSION);
VOID    VideoTiming(PHW_DEVICE_EXTENSION, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG);
VOID    InitHM(PHW_DEVICE_EXTENSION);
VOID    ResetBT439(PHW_DEVICE_EXTENSION);
VOID    Write_BT457(PHW_DEVICE_EXTENSION, ULONG, ULONG);
VOID    InitBT457(PHW_DEVICE_EXTENSION);
VOID    ProgramICD2062(PHW_DEVICE_EXTENSION, ULONG, ULONG);

/***************************************************************************
 *
 *  NeTpower NeTgraphics 1280 mode tables.
 *
 *  Created:
 *  August 27, 1993 -by- Jeffrey Newman (NewCon)
 *
 *  Copyright (c) Newman Consulting 1993
 *  Copyright (c) Media Vision 1993
 ***************************************************************************/

MVPG_MODE   aMvpgModes[] = {
    {
        {"1280X1024X32bpp@60Hz"},
        {   sizeof(VIDEO_MODE_INFORMATION),
            0,
            1280,
            1024,
            2048 * 4,
            1,
            32,
            60,
            800,
            600,
            8,
            8,
            8,
            0xFF0000,
            0x00FF00,
            0x0000FF,
#if 1
	    0,
#else
	    VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
#endif
            1280,
            1024
        },
        {
            253,
            333,
            269,
            291,
            1023,
            1066,
            1024,
            1029
        },
        {
            0x000f71a0 | (3 << 21),
            0x00183002
        },
        {
            0x06 |                  // Define byte lanes as RGB, from LSB to MSB.
            G_MODE1280 |            // Select 1280x1024 mode.
            G_MASKVINTR |           // Mask off the vertical retrace interrupt.
            G_RST439 |              // Stop resetting the BT439 chip.
            G_SYNCPOL |             // Sync polarity is active low.
            G_WAIT3 |               // Select 0 wait states.
            G_NOSYNCGRN |           // Disable sync on green channel.
            HM_GFX_IRQ_SEL          // Select vertical retrace IRQ.
        },
        {
           0xC0C0C0
        }
    },

    {
        {"1024X768X32bpp@60Hz"},
        {   sizeof(VIDEO_MODE_INFORMATION),
            1,
            1024,
            768,
            2048 * 4,
            1,
            32,
            60,
            800,
            600,
            8,
            8,
            8,
            0xFF0000,
            0x00FF00,
            0x0000FF,
#if 1
	    0,
#else
            VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
#endif
            1024,
            768
        },
        {
            253,
            330,
            268,
            294,
            768,
            805,
            770,
            776
        },
        {
            0x000f71a0 | (3 << 21),
            0x00068c0f
        },
        {
            0x06 |                  // Define byte lanes as RGB, from LSB to MSB.
            G_MASKVINTR |           // Mask off the vertical retrace interrupt.
            G_RST439 |              // Stop resetting the BT439 chip.
            G_SYNCPOL |             // Sync polarity is active low.
            G_WAIT3 |               // Select 0 wait states.
            G_NOSYNCGRN |           // Disable sync on green channel.
            HM_GFX_IRQ_SEL          // Select vertical retrace IRQ.
        },
        {
           0x404040
        }
    },

    {
        // This is a special debug mode that returns a 1024 mode
        // to the display driver, but really sets the chip to 1280 mode.

        {"1024X768X32bpp@70Hz"},
        {   sizeof(VIDEO_MODE_INFORMATION),
            2,
            1024,
            768,
            2048 * 4,
            1,
            32,
            70,
            800,
            600,
            8,
            8,
            8,
            0xFF0000,
            0x00FF00,
            0x0000FF,
#if 1
	    0,
#else
            VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
#endif
            1024,
            768
        },
        {
            253,
            333,
            269,
            291,
            1023,
            1066,
            1024,
            1029
        },
        {
            0x000f71a0 | (3 << 21),
            0x00183002
        },
        {
            0x06 |                  // Define byte lanes as RGB, from LSB to MSB.
            G_MODE1280 |            // Select 1280x1024 mode.
            G_MASKVINTR |           // Mask off the vertical retrace interrupt.
            G_RST439 |              // Stop resetting the BT439 chip.
            G_SYNCPOL |             // Sync polarity is active low.
            G_WAIT3 |               // Select 0 wait states.
            G_NOSYNCGRN |           // Disable sync on green channel.
            HM_GFX_IRQ_SEL          // Select vertical retrace IRQ.
        },
        {
           0xC0C0C0
        }
    }

};

#endif // __HM_H__