Line 1... |
Line 1... |
/* Simple frame buffer test. Draws some horizontal with different colors. */
|
/* Simple frame buffer test. Draws some horizontal with different colors. */
|
#include "support.h"
|
#include "support.h"
|
|
|
#define BUF_ADDR ((unsigned char *)0xb4000000)
|
#define BUFADDR 0xb4000000
|
#define PAL_ADDR ((unsigned long *)0xb8000000)
|
#define BASEADDR 0xb8000000
|
|
#define BUF_PTR ((unsigned char *)BUFADDR)
|
|
#define PAL_PTR ((unsigned long *)(BASEADDR + 0x400))
|
#define SIZEX 640
|
#define SIZEX 640
|
#define SIZEY 480
|
#define SIZEY 480
|
|
|
#define putxy(x,y) *(BUF_ADDR + (x) + (y) * SIZEX)
|
#define putxy(x,y) *(BUF_PTR + (x) + (y) * SIZEX)
|
#define setpal(i,r,g,b) *(PAL_ADDR + (i)) = (((unsigned long)(r) & 0xff) << 16) | (((unsigned long)(g) & 0xff) << 8) | (((unsigned long)(b) & 0xff) << 0)
|
#define setpal(i,r,g,b) *(PAL_PTR + (i)) = (((unsigned long)(r) & 0xff) << 16) | (((unsigned long)(g) & 0xff) << 8) | (((unsigned long)(b) & 0xff) << 0)
|
|
|
void hline (int y, int x1, int x2, unsigned char c)
|
void hline (int y, int x1, int x2, unsigned char c)
|
{
|
{
|
int x;
|
int x;
|
for (x = x1; x < x2; x++)
|
for (x = x1; x < x2; x++)
|
Line 18... |
Line 20... |
|
|
int main(void)
|
int main(void)
|
{
|
{
|
unsigned i;
|
unsigned i;
|
|
|
|
/* Set address of buffer at predefined location */
|
|
*((unsigned long *)(BASEADDR) + 0x1) = BUFADDR;
|
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
setpal (i, 256 - i, i, 128 ^ i);
|
setpal (i, 256 - i, i, 128 ^ i);
|
|
|
|
/* Turn display on */
|
|
*((unsigned long *)(BASEADDR) + 0x0) = 0xffffffff;
|
|
|
for (i = 0; i < 256; i++) {
|
for (i = 0; i < 256; i++) {
|
hline (i, 0, i, i);
|
hline (i, 0, i, i);
|
hline (256 - i, 256 - i, 256 + i, i);
|
hline (256 - i, 256 - i, 256 + i, i);
|
}
|
}
|
|
|