only foo
[my-code/arm.git] / betty / display.c
1 /*
2  * display.c - handling the display
3  *
4  * author: hackbard@hackdaworld.org
5  *
6  */
7
8 #include "display.h"
9
10 /*
11  * functions
12  */
13
14 void display_clear_screen(void) {
15
16         u32 cnt;
17
18         DISPLAY_SET_PAGE_ADDR(0);
19         DISPLAY_SET_C_ADDR(0);
20
21         for(cnt=0;cnt<DISPLAY_RAM_CONTENT;cnt++)
22                 DISPLAY_DATA=0x00;
23 }
24
25 void display_init(void) {
26
27         /* configure the ext mem bank interface */
28         BCFG1=0x00000c42;
29
30         DISPLAY_EXIT_POWER_SAVE;
31
32         /* reset the display, wait until its up again */
33         DISPLAY_SOFT_RESET;
34         pause(0xffffff);
35
36         DISPLAY_START_OSCILLATOR;
37
38         DISPLAY_SET_POWER(DISPLAY_V_BOOST|DISPLAY_REGULATOR);
39
40         display_clear_screen();
41
42         DISPLAY_SET_ON;
43 }
44
45 void display_load_logo(u8 *src) {
46
47         u32 cnt;
48
49         DISPLAY_SET_PAGE_ADDR(0);
50         DISPLAY_SET_C_ADDR(0);
51
52         for(cnt=0;cnt<DISPLAY_RAM_CONTENT;cnt++)
53                 DISPLAY_DATA=src[cnt];
54 }
55
56 void display_bl_init(void) {
57
58         PINSEL0&=~(1<<9|(1<<8));
59         IODIR0|=(1<<4);
60 }
61
62 void display_bl_toggle(void) {
63
64         if(IOPIN0&(1<<4))
65                 IOCLR0=(1<<4);
66         else
67                 IOSET0=(1<<4);
68 }
69
70 void display_bl_on(void) {
71
72         IOCLR0=(1<<4);
73 }
74
75 void display_bl_off(void) {
76
77         IOSET0=(1<<4);
78 }
79