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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_63/] [or1ksim/] [peripheral/] [fb.c] - Diff between revs 799 and 805

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

Rev 799 Rev 805
Line 19... Line 19...
 
 
#include <stdio.h>
#include <stdio.h>
#include "sim-config.h"
#include "sim-config.h"
#include "abstract.h"
#include "abstract.h"
#include "fb.h"
#include "fb.h"
 
#include "sched.h"
 
 
#define FB_WRAP (512*1024)
#define FB_WRAP (512*1024)
 
 
static unsigned long pal[256];
static unsigned long pal[256];
static int fb_ctrl = 0;
static int fb_ctrl = 0;
static int fb_pic = 0;
static int fb_pic = 0;
static int fb_cycles = 0;
 
static unsigned long fb_addr = 0;
static unsigned long fb_addr = 0;
 
 
static void change_buf_addr (unsigned long addr)
static void change_buf_addr (unsigned long addr)
{
{
  fb_addr = addr;
  fb_addr = addr;
Line 150... Line 150...
  if (config.sim.verbose) printf ("DONE\n");
  if (config.sim.verbose) printf ("DONE\n");
  fclose (fo);
  fclose (fo);
  return 0;
  return 0;
}
}
 
 
 
void fb_job (int param)
 
{
 
  /* dump the image? */
 
  if (fb_ctrl) {
 
    char temp[STR_SIZE];
 
    sprintf (temp, "%s%04i.bmp", &config.fb.filename[0], fb_pic);
 
    fb_dump_image (temp);
 
    fb_pic++;
 
  }
 
  SCHED_ADD(fb_job, 0, cycles + config.fb.refresh_rate);
 
}
 
 
/* Reset all VGAs */
/* Reset all VGAs */
void fb_reset ()
void fb_reset ()
{
{
  int i;
  int i;
 
 
  if (config.fb.enabled) {
  if (config.fb.enabled) {
    fb_pic = 0;
    fb_pic = 0;
    fb_cycles = 0;
 
    fb_addr = 0;
    fb_addr = 0;
    fb_ctrl = 0;
    fb_ctrl = 0;
 
 
    for (i = 0; i < 256; i++)
    for (i = 0; i < 256; i++)
      pal[i] = (i << 16) | (i << 8) | (i << 0);
      pal[i] = (i << 16) | (i << 8) | (i << 0);
 
 
 
 
 
 
    if (config.fb.baseaddr)
    if (config.fb.baseaddr)
      register_memoryarea(config.fb.baseaddr, FB_PAL + 256*4, 4, fb_read32, fb_write32);
      register_memoryarea(config.fb.baseaddr, FB_PAL + 256*4, 4, fb_read32, fb_write32);
  }
    SCHED_ADD(fb_job, 0, cycles + config.fb.refresh_rate);
}
 
 
 
/* Handles one VGA clock */
 
void fb_clock ()
 
{
 
  /* dump the image? */
 
  if (fb_ctrl && fb_cycles++ >= config.fb.refresh_rate) {
 
    char temp[STR_SIZE];
 
    sprintf (temp, "%s%04i.bmp", &config.fb.filename[0], fb_pic);
 
    fb_dump_image (temp);
 
    fb_cycles = 0;
 
    fb_pic++;
 
  }
  }
}
}
 
 
 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.