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

Subversion Repositories or1k

[/] [or1k/] [tags/] [stable_0_2_0_rc2/] [or1ksim/] [peripheral/] [vga.c] - Diff between revs 1308 and 1350

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

Rev 1308 Rev 1350
Line 16... Line 16...
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
#include <stdio.h>
#include <stdio.h>
 
 
 
#include "config.h"
 
 
 
#ifdef HAVE_INTTYPES_H
 
#include <inttypes.h>
 
#endif
 
 
 
#include "port.h"
 
#include "arch.h"
#include "sim-config.h"
#include "sim-config.h"
#include "vga.h"
#include "vga.h"
#include "abstract.h"
#include "abstract.h"
#include "sched.h"
#include "sched.h"
 
 
Line 34... Line 43...
  unsigned long palette[2][256];
  unsigned long palette[2][256];
} vga[MAX_VGAS];
} vga[MAX_VGAS];
 
 
 
 
/* Write a register */
/* Write a register */
void vga_write32(unsigned long addr, unsigned long value)
void vga_write32(oraddr_t addr, uint32_t value)
{
{
  int i, found = -1;
  int i, found = -1;
 
 
  /* Find which controller this is */
  /* Find which controller this is */
  for (i = 0; i < config.nvgas; i++ ) {
  for (i = 0; i < config.nvgas; i++ ) {
Line 47... Line 56...
      break;
      break;
    }
    }
  }
  }
 
 
  if (found < 0) {
  if (found < 0) {
    fprintf( stderr, "vga_write32( 0x%08lX ): Out of range\n", addr);
    fprintf( stderr, "vga_write32( 0x%"PRIxADDR" ): Out of range\n", addr);
    runtime.sim.cont_run = 0;
    runtime.sim.cont_run = 0;
    return;
    return;
  }
  }
 
 
  addr -= config.vgas[found].baseaddr;
  addr -= config.vgas[found].baseaddr;
Line 68... Line 77...
      if (addr >= VGA_CLUTA && addr < VGA_CLUTB) {
      if (addr >= VGA_CLUTA && addr < VGA_CLUTB) {
        vga[found].palette[0][addr - VGA_CLUTA] = value & 0x00ffffff;
        vga[found].palette[0][addr - VGA_CLUTA] = value & 0x00ffffff;
      } else if (addr >= VGA_CLUTB) {
      } else if (addr >= VGA_CLUTB) {
        vga[found].palette[1][addr - VGA_CLUTB] = value & 0x00ffffff;
        vga[found].palette[1][addr - VGA_CLUTB] = value & 0x00ffffff;
      } else {
      } else {
        fprintf( stderr, "vga_write32( 0x%08lX, 0x%08lX ): Out of range\n", addr + config.vgas[found].baseaddr, value);
        fprintf( stderr, "vga_write32( 0x%"PRIxADDR", 0x%08"PRIx32" ): Out of range\n", addr + config.vgas[found].baseaddr, value);
        runtime.sim.cont_run = 0;
        runtime.sim.cont_run = 0;
        return;
        return;
      }
      }
      break;
      break;
  }
  }
}
}
 
 
/* Read a register */
/* Read a register */
unsigned long vga_read32(unsigned long addr)
uint32_t vga_read32(oraddr_t addr)
{
{
  int i, found = -1;
  int i, found = -1;
 
 
  /* Find which controller this is */
  /* Find which controller this is */
  for (i = 0; i < config.nvgas; i++ ) {
  for (i = 0; i < config.nvgas; i++ ) {
Line 90... Line 99...
      break;
      break;
    }
    }
  }
  }
 
 
  if (found < 0) {
  if (found < 0) {
    fprintf( stderr, "vga_read32( 0x%08lX ): Out of range\n", addr);
    fprintf( stderr, "vga_read32( 0x%"PRIxADDR" ): Out of range\n", addr);
    runtime.sim.cont_run = 0;
    runtime.sim.cont_run = 0;
    return 0;
    return 0;
  }
  }
 
 
  addr -= config.vgas[found].baseaddr;
  addr -= config.vgas[found].baseaddr;
Line 111... Line 120...
      if (addr >= VGA_CLUTA && addr < VGA_CLUTB) {
      if (addr >= VGA_CLUTA && addr < VGA_CLUTB) {
        return vga[found].palette[0][addr - VGA_CLUTA];
        return vga[found].palette[0][addr - VGA_CLUTA];
      } else if (addr >= VGA_CLUTB) {
      } else if (addr >= VGA_CLUTB) {
        return vga[found].palette[1][addr - VGA_CLUTB];
        return vga[found].palette[1][addr - VGA_CLUTB];
      } else {
      } else {
        fprintf( stderr, "vga_read32( 0x%08lX ): Out of range\n", addr);
        fprintf( stderr, "vga_read32( 0x%"PRIxADDR" ): Out of range\n", addr);
        runtime.sim.cont_run = 0;
        runtime.sim.cont_run = 0;
        return 0;
        return 0;
      }
      }
      break;
      break;
  }
  }

powered by: WebSVN 2.1.0

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