comparison experiments/qemu_vexpress_a9/display.c @ 340:c7cc54c0dfdf devel

Test featurebranch
author Windel Bouwman
date Sun, 23 Feb 2014 16:24:01 +0100
parents
children
comparison
equal deleted inserted replaced
339:6ee17c4dd6b8 340:c7cc54c0dfdf
1
2
3 #define PL110_CR_EN 0x001
4 #define PL110_CR_16BPP 0x008
5 #define PL110_CR_MONO 0x010
6 #define PL110_CR_TFT 0x020
7 #define PL110_CR_MONO_8B 0x040
8 #define PL110_CR_DUAL_LCD 0x080
9 #define PL110_CR_BGR 0x100
10 #define PL110_CR_BEBO 0x200
11 #define PL110_CR_BEPO 0x400
12 #define PL110_CR_PWR 0x800
13
14
15
16
17 #define PL110_IOBASE 0x10020000
18 #define FB_BASE 0x60050000
19
20
21 typedef unsigned int uint32;
22 typedef unsigned char uint8;
23 typedef unsigned short uint16;
24
25 typedef struct
26 {
27 uint32 volatile tim0; //0
28 uint32 volatile tim1; //4
29 uint32 volatile tim2; //8
30 uint32 volatile tim3; //c
31 uint32 volatile upbase; //10
32 uint32 volatile lpbase; //14
33 uint32 volatile control; //18
34 } PL111MMIO;
35
36 void print_uart0(const char *s);
37
38 extern uint16* image_data;
39 extern int image_width;
40 extern int image_height;
41
42 void do_display(void)
43 {
44 uint16 volatile *fb;
45 PL111MMIO *plio;
46 int x, y;
47
48 plio = (PL111MMIO*)PL110_IOBASE;
49
50 plio->tim0 = 0x3f1f3f9c;
51 plio->tim1 = 0x080b61df;
52 plio->upbase = FB_BASE;
53
54 /* 16-bit color */
55 plio->control = PL110_CR_EN | (0xC) | PL110_CR_TFT | PL110_CR_PWR;
56
57 fb = (uint16*)FB_BASE;
58
59 for (x = 0; x < (640 * 480) - 10; ++x)
60 {
61 fb[x] = 0x1f << (5 + 6) | 0xf << 5;
62 }
63
64 print_uart0("Cleared disp\n");
65
66 for (x = 0; x < image_width; x++)
67 {
68 for (y = 0; y < image_height; y++)
69 {
70 fb[x + 640 * y] = image_data[x + image_width * y];
71 }
72 }
73
74 }
75