OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_2_x/] [or1ksim/] [peripheral/] [vga.c] - Diff between revs 645 and 805

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 645 Rev 805
Line 19... Line 19...
 
 
#include <stdio.h>
#include <stdio.h>
#include "sim-config.h"
#include "sim-config.h"
#include "vga.h"
#include "vga.h"
#include "abstract.h"
#include "abstract.h"
 
#include "sched.h"
 
 
/* When this counter reaches config.vgas[].refresh_rate, a screenshot is taken and outputted */
/* When this counter reaches config.vgas[].refresh_rate, a screenshot is taken and outputted */
static struct {
static struct {
  int cycles;
 
  int pics;
  int pics;
  unsigned long ctrl, stat, htim, vtim;
  unsigned long ctrl, stat, htim, vtim;
  int vbindex;
  int vbindex;
  unsigned long vbar[2];
  unsigned long vbar[2];
  unsigned hlen, vlen;
  unsigned hlen, vlen;
Line 215... Line 215...
  fclose (fo);
  fclose (fo);
  return 0;
  return 0;
}
}
#endif /* !__BIG_ENDIAN__ */
#endif /* !__BIG_ENDIAN__ */
 
 
 
void vga_job (int param)
 
{
 
  /* dump the image? */
 
  char temp[STR_SIZE];
 
  sprintf (temp, "%s%04i.bmp", config.vgas[param].filename, vga[param].pics++);
 
  vga_dump_image (temp, param);
 
 
 
  SCHED_ADD(vga_job, param, cycles + config.vgas[param].refresh_rate);
 
}
 
 
/* Reset all VGAs */
/* Reset all VGAs */
void vga_reset ()
void vga_reset ()
{
{
  int i, j;
  int i, j;
  for (i = 0; i < config.nvgas; i++) {
  for (i = 0; i < config.nvgas; i++) {
Line 231... Line 241...
    vga[i].hlen = vga[i].vlen = 0;
    vga[i].hlen = vga[i].vlen = 0;
    vga[i].vbar[0] = vga[i].vbar[1] = 0;
    vga[i].vbar[0] = vga[i].vbar[1] = 0;
 
 
    /* Init screen dumping machine */
    /* Init screen dumping machine */
    vga[i].pics = 0;
    vga[i].pics = 0;
    vga[i].cycles = 0;
 
 
 
    vga[i].pindex = 0;
    vga[i].pindex = 0;
    vga[i].vbindex = 0;
    vga[i].vbindex = 0;
 
 
    if (config.vgas[i].baseaddr)
    if (config.vgas[i].baseaddr)
      register_memoryarea(config.vgas[i].baseaddr, VGA_ADDR_SPACE, 4, vga_read32, vga_write32);
      register_memoryarea(config.vgas[i].baseaddr, VGA_ADDR_SPACE, 4, vga_read32, vga_write32);
  }
    SCHED_ADD(vga_job, i, cycles + config.vgas[i].refresh_rate);
}
 
 
 
/* Handles one VGA clock */
 
void vga_clock ()
 
{
 
  int i;
 
  for (i = 0; i < config.nvgas; i++) {
 
    /* dump the image? */
 
    if (vga[i].cycles++ >= config.vgas[i].refresh_rate) {
 
      char temp[STR_SIZE];
 
      sprintf (temp, "%s%04i.bmp", config.vgas[i].filename, vga[i].pics++);
 
      vga_dump_image (temp, i);
 
      vga[i].cycles = 0;
 
    }
 
  }
  }
}
}
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.