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

Subversion Repositories or1k

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

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

Rev 805 Rev 845
Line 26... Line 26...
#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_in_refresh = 1;
 
static int fb_refresh_count = 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 38... Line 40...
/* Write a register */
/* Write a register */
void fb_write32 (unsigned long addr, unsigned long value)
void fb_write32 (unsigned long addr, unsigned long value)
{
{
  int a = (addr - config.fb.baseaddr);
  int a = (addr - config.fb.baseaddr);
  switch (a) {
  switch (a) {
    case FB_CTRL:    fb_ctrl = value; break;
    case FB_CTRL:    fb_ctrl = value & 0x00000001; break;
    case FB_BUFADDR: change_buf_addr (value); break;
    case FB_BUFADDR: change_buf_addr (value); break;
    default:
    default:
      a -= FB_PAL;
      a -= FB_PAL;
      a /= 4;
      a /= 4;
      if (a < 0 || a >= 256) {
      if (a < 0 || a >= 256) {
Line 56... Line 58...
/* Read a register */
/* Read a register */
unsigned long fb_read32 (unsigned long addr)
unsigned long fb_read32 (unsigned long addr)
{
{
  int a = (addr - config.fb.baseaddr);
  int a = (addr - config.fb.baseaddr);
  switch (a) {
  switch (a) {
    case FB_CTRL:    return fb_ctrl; break;
    case FB_CTRL:
 
      return fb_ctrl | (fb_in_refresh ? 2 : 0) | ((fb_refresh_count & 0xff) << 8);
 
      break;
    case FB_BUFADDR: return fb_addr; break;
    case FB_BUFADDR: return fb_addr; break;
    default:
    default:
      a -= FB_PAL;
      a -= FB_PAL;
      a /= 4;
      a /= 4;
      if (a < 0 || a >= 256) {
      if (a < 0 || a >= 256) {
Line 152... Line 156...
  return 0;
  return 0;
}
}
 
 
void fb_job (int param)
void fb_job (int param)
{
{
 
  if (param) {
  /* dump the image? */
  /* dump the image? */
  if (fb_ctrl) {
  if (fb_ctrl) {
    char temp[STR_SIZE];
    char temp[STR_SIZE];
    sprintf (temp, "%s%04i.bmp", &config.fb.filename[0], fb_pic);
    sprintf (temp, "%s%04i.bmp", &config.fb.filename[0], fb_pic);
    fb_dump_image (temp);
    fb_dump_image (temp);
    fb_pic++;
    fb_pic++;
  }
  }
  SCHED_ADD(fb_job, 0, cycles + config.fb.refresh_rate);
    SCHED_ADD(fb_job, 0, cycles + config.fb.refresh_rate - config.fb.refresh_rate / REFRESH_DIVIDER);
 
    fb_in_refresh = 0;
 
  } else {
 
    fb_refresh_count++;
 
    SCHED_ADD(fb_job, 1, cycles + config.fb.refresh_rate / REFRESH_DIVIDER);
 
 
 
  }
}
}
 
 
/* Reset all VGAs */
/* Reset all VGAs */
void fb_reset ()
void fb_reset ()
{
{

powered by: WebSVN 2.1.0

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