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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [or1ksim/] [testbench/] [fbtest.c] - Blame information for rev 970

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

Line No. Rev Author Line
1 645 markom
/* Simple frame buffer test. Draws some horizontal with different colors. */
2
#include "support.h"
3
 
4 970 simons
#define BUFADDR   0x00100000
5
#define BASEADDR  0x97000000
6 647 markom
#define BUF_PTR  ((unsigned char *)BUFADDR)
7
#define PAL_PTR  ((unsigned long *)(BASEADDR + 0x400))
8 645 markom
#define SIZEX     640
9
#define SIZEY     480
10
 
11 647 markom
#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 645 markom
 
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 647 markom
  /* Set address of buffer at predefined location */
26
  *((unsigned long *)(BASEADDR) + 0x1) = BUFADDR;
27 645 markom
  for (i = 0; i < 256; i++)
28
    setpal (i, 256 - i, i, 128 ^ i);
29 648 markom
 
30 647 markom
  /* Turn display on */
31
  *((unsigned long *)(BASEADDR) + 0x0) = 0xffffffff;
32 645 markom
 
33 956 simons
  for (i = 0; i < 16; i++) {
34 645 markom
    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.