Ejemplo n.º 1
0
void
main (void)
{
  vga_init ();
  if (vga_getcurrentchipset () != CIRRUS)
    {
      printf ("Not a Cirrus.\n");
      printf ("Continue anyway (y/n)?\n");
      if (getchar () != 'y')
	exit (-1);
    }

  /* Unlock extended registers. */
  outb (0x3c4, 0x06);
  outb (0x3c5, 0x12);


  /*
     Tested on VLB AVGA3 CL-GD5426 on 40MHz VLB
     0x1c         50 MHz (boot-up default)
     0x21         59
     0x22         62
     0x23 OK
     0x24 OK
     0x25 OK
     0x26 OK              [This corresponds to the highest value
     mentioned in the databook (which does
     not mean that it is supposed to work
     on all cards); the book also says the
     parts are not specified for more than
     50 MHz].
     0x27 occasional loose pixels
     0x28 occasional problems
     0x29 some problems
     0x2A 16M/textmode problems
     0x2c 256/32k color problems
   */
  outb (0x3c4, 0x1f);
  printf ("Old MCLK value: %02x\n", inb (0x3c5));
  outb (0x3c4, 0x1f);
  outb (0x3c5, NEW_MCLK);
  printf ("New MCLK value: %02x\n", NEW_MCLK);

  exit (0);
}
Ejemplo n.º 2
0
int main(int argc, char *argv[])
{
    int i,j;

    if (!(argc == 2 && strcmp(argv[1], "--force") == 0))
	if (!(vga_getmodeinfo(vga_getdefaultmode())->flags & CAPABLE_LINEAR)) {
	    printf("Linear addressing not supported for this chipset.\n");
	    exit(1);
	}
    vga_init();
    vga_setmode(vga_getdefaultmode());
    vga_setpage(0);
#ifdef USE_LINEAR_ADDRESSING
    if (vga_setlinearaddressing() == -1) {
	vga_setmode(TEXT);
	printf("Could not set linear addressing.\n");
	exit(-1);
    }
#endif

    /* Should not mess with bank register after this. */

    vbuf = vga_getgraphmem();
    printf("vbuf mapped at %08lx.\n", (unsigned long) vbuf);

    getchar();

#ifdef USE_LINEAR_ADDRESSING
    memset(vbuf, 0x88, 640 * 480);
    sleep(1);

    memset(vbuf, 0, 640 * 480);
    for (i = 0; i < 100000; i++)
	*(vbuf + (rand() & 0xfffff)) = rand();
#endif

#if 0
    if (vga_getcurrentchipset() == CIRRUS)
		/* Show the bandwidth of the extended write modes of the */
		/* Cirrus chip. */
		by8test();
#endif

    getchar();
    for(i = 0;i < 44;i++){
      *(vbuf + i) = 0x1c;
      *(vbuf + 640*17 + i) = 0x1c;
      *(vbuf + 640*480 - i) = 0x1c;
      *(vbuf + 640*480 - 1 - 640*17 - i) = 0x1c;
      for(j = 1;j < 17;j++){
	*(vbuf + 640*j + i) = (i == 0 || i == 43)? 0x1c:0;
	*(vbuf + 640*480 - 1 - 640*j - i) = (i == 0 || i == 43)? 0x1c:0;
      }
    }
    for(i = 3;i < 10;i++)
      for(j = 4;j < 10;j++){
	*(vbuf + i + 640*j) = 0x3f;
	*(vbuf + 640*480 -1 -640*j - i) = 0x3f;
      }
    getchar();
    vga_setmode(TEXT);
    return 0;
}