annotate experiments/qemu_vexpress_a9/display.c @ 342:86b02c98a717 devel

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