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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [or1ksim/] [or1ksim-0.3.0/] [testbench/] [fbtest.c] - Blame information for rev 783

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 jeremybenn
/* Simple frame buffer test. Draws some horizontal with different colors. */
2
#include "support.h"
3
 
4
#define BUFADDR   0x00100000
5
#define BASEADDR  0x97000000
6
#define BUF_PTR  ((unsigned char *)BUFADDR)
7
#define PAL_PTR  ((unsigned long *)(BASEADDR + 0x400))
8
#define SIZEX     640
9
#define SIZEY     480
10
 
11
#define putxy(x,y) *(BUF_PTR + (x) + (y) * SIZEX)
12
#define setpal(i,r,g,b) *(PAL_PTR + (i)) = (((unsigned long)(r) & 0xff) << 16) | (((unsigned long)(g) & 0xff) << 8) | (((unsigned long)(b) & 0xff) << 0)
13
 
14
void hline (int y, int x1, int x2, unsigned char c)
15
{
16
  int x;
17
  for (x = x1; x < x2; x++)
18
    putxy(x, y) = c;
19
}
20
 
21
int main(void)
22
{
23
  unsigned i;
24
 
25
  /* Set address of buffer at predefined location */
26
  *((unsigned long *)(BASEADDR) + 0x1) = BUFADDR;
27
  for (i = 0; i < 256; i++)
28
    setpal (i, 256 - i, i, 128 ^ i);
29
 
30
  /* Turn display on */
31
  *((unsigned long *)(BASEADDR) + 0x0) = 0xffffffff;
32
 
33
  for (i = 0; i < 16; i++) {
34
    hline (i, 0, i, i);
35
    hline (256 - i, 256 - i, 256 + i, i);
36
  }
37
 
38
  report (0xdeaddead);
39
  return 0;
40
}

powered by: WebSVN 2.1.0

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