/*
* Tvp3026 Viewpoint Video Interface Palette.
* Assumes hooked up to an S3 chip of some kind.
* Why is register access different from the
* Tvp302[05]?
*/
enum {
Index = 0x00, /* Index register */
Data = 0x0A, /* Data register */
/*
* Work out the part speed-grade from name. Name can have,
* e.g. '-135' on the end for 135MHz part.
*/
grade = 110000000;
if(p = strrchr(ctlr->name, '-'))
grade = strtoul(p+1, 0, 0) * 1000000;
/*
* If we don't already have a desired pclk,
* take it from the mode.
* Check it's within range.
*/
if(vga->f[0] == 0)
vga->f[0] = vga->mode->frequency;
if(vga->f[0] > grade)
error("%s: invalid pclk - %ld\n", ctlr->name, vga->f[0]);
/*
* Determine whether to use clock-doubler or not.
*/
if((ctlr->flag & Uclk2) == 0 && vga->mode->z == 8 && vga->f[0] > 85000000)
resyncinit(vga, ctlr, Uclk2, 0);
ctlr->flag |= Finit;
}
static void
load(Vga* vga, Ctlr* ctlr)
{
uchar x;
/*
* General Control:
* output sync polarity
* It's important to set this properly and to turn off the
* VGA controller H and V syncs. Can't be set in VGA mode.
*/
x = 0x00;
if((vga->misc & 0x40) == 0)
x |= 0x01;
if((vga->misc & 0x80) == 0)
x |= 0x02;
tvp3026xo(0x1D, x);
vga->misc |= 0xC0;
vgao(MiscW, vga->misc);