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
|
#include <u.h>
#include <libc.h>
#include <bio.h>
#include "pci.h"
#include "vga.h"
/*
* Tvp3025 Viewpoint Video Interface Pallette.
* Assumes hooked up to an S3 Vision964.
* The #9GXE64pro uses bit 5 of Crt5C as RS4,
* giving access to the Bt485 emulation mode registers.
*/
static void
options(Vga* vga, Ctlr* ctlr)
{
tvp3020.options(vga, ctlr);
}
static void
init(Vga* vga, Ctlr* ctlr)
{
/*
* Although the Tvp3025 has a higher default
* speed-grade (135MHz), just use the 3020 code.
*/
tvp3020.init(vga, ctlr);
}
static void
load(Vga* vga, Ctlr* ctlr)
{
uchar crt5c, x;
crt5c = vgaxi(Crtx, 0x5C) & ~0x20;
vgaxo(Crtx, 0x5C, crt5c);
x = tvp3020xi(0x06) & ~0x80;
tvp3020xo(0x06, x);
tvp3020xo(0x0E, 0x00);
(tvp3020.load)(vga, ctlr);
if(ctlr->flag & Uenhanced)
tvp3020xo(0x29, 0x01);
ctlr->flag |= Fload;
}
static ulong
dumpclock(ulong d, ulong n, ulong p)
{
ulong f;
f = RefFreq*((n+2)*8);
f /= (d+2);
f >>= p;
return f;
}
static void
dump(Vga* vga, Ctlr* ctlr)
{
uchar crt5c;
int i;
ulong clock[4];
crt5c = vgaxi(Crtx, 0x5C);
vgaxo(Crtx, 0x5C, crt5c & ~0x20);
tvp3020.dump(vga, ctlr);
printitem(ctlr->name, "PCLK");
for(i = 0; i < 4; i++){
tvp3020xo(0x2C, (i<<4)|(i<<2)|i);
printreg(clock[i] = tvp3020xi(0x2D));
}
Bprint(&stdout, "%23ld\n", dumpclock(clock[0], clock[1], clock[2] & 0x07));
printitem(ctlr->name, "MCLK");
for(i = 0; i < 4; i++){
tvp3020xo(0x2C, (i<<4)|(i<<2)|i);
printreg(clock[i] = tvp3020xi(0x2E));
}
Bprint(&stdout, "%23ld\n", dumpclock(clock[0], clock[1], clock[2] & 0x07));
printitem(ctlr->name, "RCLK");
for(i = 0; i < 4; i++){
tvp3020xo(0x2C, (i<<4)|(i<<2)|i);
printreg(clock[i] = tvp3020xi(0x2F));
}
Bprint(&stdout, "%23ld\n", dumpclock(clock[0], clock[1], clock[2] & 0x07));
vgaxo(Crtx, 0x5C, crt5c);
}
Ctlr tvp3025 = {
"tvp3025", /* name */
0, /* snarf */
options, /* options */
init, /* init */
load, /* load */
dump, /* dump */
};
|