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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [testsuite/] [test-code-or1k/] [fbtest/] [fbtest.c] - Blame information for rev 352

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

Line No. Rev Author Line
1 90 jeremybenn
/* fbtest.c. Test of Or1ksim frame buffer
2
 
3
   Copyright (C) 1999-2006 OpenCores
4
   Copyright (C) 2010 Embecosm Limited
5
 
6
   Contributors various OpenCores participants
7
   Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
8
 
9
   This file is part of OpenRISC 1000 Architectural Simulator.
10
 
11
   This program is free software; you can redistribute it and/or modify it
12
   under the terms of the GNU General Public License as published by the Free
13
   Software Foundation; either version 3 of the License, or (at your option)
14
   any later version.
15
 
16
   This program is distributed in the hope that it will be useful, but WITHOUT
17
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
19
   more details.
20
 
21
   You should have received a copy of the GNU General Public License along
22
   with this program.  If not, see <http:  www.gnu.org/licenses/>.  */
23
 
24
/* ----------------------------------------------------------------------------
25
   This code is commented throughout for use with Doxygen.
26
   --------------------------------------------------------------------------*/
27
 
28
/* Simple frame buffer test. Draws some horizontal with different colors. */
29
#include "support.h"
30
 
31
#define BUFADDR   0x00100000
32
#define BASEADDR  0x97000000
33
#define BUF_PTR  ((unsigned char *)BUFADDR)
34
#define PAL_PTR  ((unsigned long *)(BASEADDR + 0x400))
35
#define SIZEX     640
36
#define SIZEY     480
37
 
38
#define putxy(x,y) *(BUF_PTR + (x) + (y) * SIZEX)
39
#define setpal(i,r,g,b) *(PAL_PTR + (i)) = (((unsigned long)(r) & 0xff) << 16) | (((unsigned long)(g) & 0xff) << 8) | (((unsigned long)(b) & 0xff) << 0)
40
 
41
void hline (int y, int x1, int x2, unsigned char c)
42
{
43
  int x;
44
  for (x = x1; x < x2; x++)
45
    putxy(x, y) = c;
46
}
47
 
48
int main(void)
49
{
50
  unsigned i;
51
 
52
  /* Set address of buffer at predefined location */
53
  *((unsigned long *)(BASEADDR) + 0x1) = BUFADDR;
54
  for (i = 0; i < 256; i++)
55
    setpal (i, 256 - i, i, 128 ^ i);
56
 
57
  /* Turn display on */
58
  *((unsigned long *)(BASEADDR) + 0x0) = 0xffffffff;
59
 
60
  for (i = 0; i < 16; i++) {
61
    hline (i, 0, i, i);
62
    hline (256 - i, 256 - i, 256 + i, i);
63
  }
64
 
65
  report (0xdeaddead);
66
  return 0;
67
}

powered by: WebSVN 2.1.0

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