Ejemplo n.º 1
0
static void
init(Vga* vga, Ctlr* ctlr)
{
	ulong grade;
	char *p;

	/*
	 * 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;
}
Ejemplo n.º 2
0
static void
init(Vga* vga, Ctlr* ctlr)
{
	char *p, *val;
	Mode *mode;
	ulong pclk, x;
	int id, noclockset, width;

	id = (vga->crt[0x2D]<<8)|vga->crt[0x2E];
	mode = vga->mode;

	/*
	 * double 16bpp horizontal timings on ViRGE/[DG]X
	 * leaves overflow bit-fiddling to s3generic.init
	 */
	if((id == 0x8A01) && ((mode->z+7)/8 == 2)){
		resyncinit(vga, ctlr, Uenhanced, 0);
		vga->crt[0x00] = ((mode->ht * 2) >> 3) - 5;
		vga->crt[0x01] = ((mode->x * 2) >> 3) - 1;
		vga->crt[0x02] = ((mode->shb * 2) >> 3) - 1;
		x = (mode->ehb * 2) >> 3;
		vga->crt[0x03] = 0x80 | (x & 0x1F);
		vga->crt[0x04] = (mode->shs * 2) >> 3;
		vga->crt[0x05] = ((mode->ehs * 2) >> 3) & 0x1F;
		if(x & 0x20)
			vga->crt[0x05] |= 0x80;
	}
Ejemplo n.º 3
0
static void
init(Vga* vga, Ctlr* ctlr)
{
	Mode *mode;
	uint32_t x;
	int sid, dbl, bpp, divide;
	char *val;

	if(vga->mode->z > 8)
		error("depth %d not supported\n", vga->mode->z);

	mode = vga->mode;
	if(vga->ramdac && (vga->ramdac->flag & Uclk2)){
		resyncinit(vga, ctlr, Uenhanced, 0);
		vga->crt[0x00] = ((mode->ht/2)>>3)-5;
		vga->crt[0x01] = ((mode->x/2)>>3)-1;
		vga->crt[0x02] = ((mode->shb/2)>>3)-1;
	
		x = (mode->ehb/2)>>3;
		vga->crt[0x03] = 0x80|(x & 0x1F);
		vga->crt[0x04] = (mode->shs/2)>>3;
		vga->crt[0x05] = ((mode->ehs/2)>>3) & 0x1F;
		if(x & 0x20)
			vga->crt[0x05] |= 0x80;
		vga->crt[0x13] = mode->x/8;
	}
Ejemplo n.º 4
0
static void
init(Vga* vga, Ctlr* ctlr)
{
	ulong grade, pclk;
	char *p;

	/*
	 * Part comes in -170, -130 and -110MHz speed-grades.
	 * In 8-bit mode the max. PCLK is 80MHz for the -110 part
	 * and 110MHz for the others. In 2x8-bit mode, the max.
	 * PCLK is the speed-grade, using the 2x doubler.
	 * We can use mode 2 (2x8-bit, internal clock doubler)
	 * if connected to a suitable graphics chip, e.g. the
	 * S3 Vision864.
	 * 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(vga->ctlr && ((vga->ctlr->flag & Hpclk2x8) && vga->mode->z == 8))
		pclk = grade;
	else{
		if(grade == 110000000)
			pclk = 80000000;
		else
			pclk = 110000000;
	}

	/*
	 * 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;

	/*
	 * Determine whether to use 2x8-bit mode or not.
	 * If yes and the clock has already been initialised,
	 * initialise it again.
	 */
	if(vga->ctlr && (vga->ctlr->flag & Hpclk2x8) && vga->mode->z == 8 && vga->f[0] > 80000000){
		vga->f[0] /= 2;
		resyncinit(vga, ctlr, Upclk2x8, 0);
	}
	if(vga->f[0] > pclk)
		error("%s: invalid pclk - %ld\n", ctlr->name, vga->f[0]);

	ctlr->flag |= Finit;
}