view experiments/qemu_vexpress_a9/display.c @ 356:52492b304adf

Added newline to print
author Windel Bouwman
date Fri, 14 Mar 2014 13:02:16 +0100
parents c7cc54c0dfdf
children
line wrap: on
line source



#define PL110_CR_EN             0x001
#define PL110_CR_16BPP          0x008
#define PL110_CR_MONO           0x010
#define PL110_CR_TFT            0x020
#define PL110_CR_MONO_8B        0x040
#define PL110_CR_DUAL_LCD       0x080
#define PL110_CR_BGR            0x100
#define PL110_CR_BEBO           0x200
#define PL110_CR_BEPO           0x400
#define PL110_CR_PWR            0x800




#define PL110_IOBASE            0x10020000
#define FB_BASE                 0x60050000


typedef unsigned int            uint32;
typedef unsigned char           uint8;
typedef unsigned short          uint16;

typedef struct
{
    uint32          volatile tim0;          //0
    uint32          volatile tim1;          //4
    uint32          volatile tim2;          //8
    uint32          volatile tim3;          //c
    uint32          volatile upbase;        //10
    uint32          volatile lpbase;        //14
    uint32          volatile control;       //18
} PL111MMIO;

void print_uart0(const char *s);

extern uint16* image_data;
extern int image_width;
extern int image_height;

void do_display(void)
{
    uint16          volatile *fb;
    PL111MMIO       *plio;
    int             x, y;

    plio = (PL111MMIO*)PL110_IOBASE;

    plio->tim0 = 0x3f1f3f9c;
    plio->tim1 = 0x080b61df;
    plio->upbase = FB_BASE;

    /* 16-bit color */
    plio->control = PL110_CR_EN | (0xC) | PL110_CR_TFT | PL110_CR_PWR;

    fb = (uint16*)FB_BASE;

    for (x = 0; x < (640 * 480) - 10; ++x)
        {
                fb[x] = 0x1f << (5 + 6) | 0xf << 5;
        }

    print_uart0("Cleared disp\n");

    for (x = 0; x < image_width; x++)
    {
        for (y = 0; y < image_height; y++)
        {
            fb[x + 640 * y] = image_data[x + image_width * y];
        }
    }

}