summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire/iaudio
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2006-03-22 09:50:35 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2006-03-22 09:50:35 +0000
commitd0e8c57b779bbf96d84c5251465dc92303df5424 (patch)
tree95927e0596e1f093dc0babf6bca29946a7954929 /firmware/target/coldfire/iaudio
parentc5b63269fc23ab6aa1231c44029b8288e6f7d519 (diff)
downloadrockbox-d0e8c57b779bbf96d84c5251465dc92303df5424.tar.gz
rockbox-d0e8c57b779bbf96d84c5251465dc92303df5424.zip
Now the X5 LCD driver works as expected
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9177 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire/iaudio')
-rwxr-xr-xfirmware/target/coldfire/iaudio/x5/lcd-x5.c54
1 files changed, 44 insertions, 10 deletions
diff --git a/firmware/target/coldfire/iaudio/x5/lcd-x5.c b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
index 0ac9f5576e..813e5b9e96 100755
--- a/firmware/target/coldfire/iaudio/x5/lcd-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
@@ -38,8 +38,45 @@ static bool display_on=false; /* is the display turned on? */
38#define R_RAM_ADDR_SET 0x21 38#define R_RAM_ADDR_SET 0x21
39#define R_WRITE_DATA_2_GRAM 0x22 39#define R_WRITE_DATA_2_GRAM 0x22
40 40
41/*****************************************************
42The tables below were generated by the following script:
43
44#!/usr/bin/perl
45
46# low byte table
47print "short low8to9[] = {\n";
48$str = " ";
49for my $m (0 .. 255) {
50 # RRRRRGGG => RRRRR0GGG
51 my $v = (($m & 0xF8) << 1) | ($m & 0x07);
52 if(length($str) > 75) {
53 print "$str\n";
54 $str=" ";
55 }
56 $str .= sprintf("0x%03x, ", $v);
57}
58print "$str\n};\n";
59
60$str = " ";
61# high byte table
62print "short high8to9[] = {\n";
63
64# high byte table
65for my $m (0 .. 255) {
66 # GGGBBBBB = GGGBBBBB0
67 my $v = (($m & 0xFF) << 1);
68 if(length($str) > 75) {
69 print "$str\n";
70 $str=" ";
71 }
72 $str .= sprintf("0x%03x, ", $v);
73}
74print "$str\n};\n";
75
76*****************************************************/
77
41/* Lookup tables for 16->18bit conversion */ 78/* Lookup tables for 16->18bit conversion */
42const short low8to9[] = { 79const short high8to9[] = {
43 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, 0x010, 0x011, 0x012, 80 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, 0x010, 0x011, 0x012,
44 0x013, 0x014, 0x015, 0x016, 0x017, 0x020, 0x021, 0x022, 0x023, 0x024, 0x025, 81 0x013, 0x014, 0x015, 0x016, 0x017, 0x020, 0x021, 0x022, 0x023, 0x024, 0x025,
45 0x026, 0x027, 0x030, 0x031, 0x032, 0x033, 0x034, 0x035, 0x036, 0x037, 0x040, 82 0x026, 0x027, 0x030, 0x031, 0x032, 0x033, 0x034, 0x035, 0x036, 0x037, 0x040,
@@ -65,7 +102,7 @@ const short low8to9[] = {
65 0x1e2, 0x1e3, 0x1e4, 0x1e5, 0x1e6, 0x1e7, 0x1f0, 0x1f1, 0x1f2, 0x1f3, 0x1f4, 102 0x1e2, 0x1e3, 0x1e4, 0x1e5, 0x1e6, 0x1e7, 0x1f0, 0x1f1, 0x1f2, 0x1f3, 0x1f4,
66 0x1f5, 0x1f6, 0x1f7, 103 0x1f5, 0x1f6, 0x1f7,
67} ICONST_ATTR; 104} ICONST_ATTR;
68const short high8to9[] = { 105const short low8to9[] = {
69 0x000, 0x002, 0x004, 0x006, 0x008, 0x00a, 0x00c, 0x00e, 0x010, 0x012, 0x014, 106 0x000, 0x002, 0x004, 0x006, 0x008, 0x00a, 0x00c, 0x00e, 0x010, 0x012, 0x014,
70 0x016, 0x018, 0x01a, 0x01c, 0x01e, 0x020, 0x022, 0x024, 0x026, 0x028, 0x02a, 107 0x016, 0x018, 0x01a, 0x01c, 0x01e, 0x020, 0x022, 0x024, 0x026, 0x028, 0x02a,
71 0x02c, 0x02e, 0x030, 0x032, 0x034, 0x036, 0x038, 0x03a, 0x03c, 0x03e, 0x040, 108 0x02c, 0x02e, 0x030, 0x032, 0x034, 0x036, 0x038, 0x03a, 0x03c, 0x03e, 0x040,
@@ -172,9 +209,9 @@ void lcd_init_device(void)
172 209
173 lcd_write_reg(0x0d, 0x0401); 210 lcd_write_reg(0x0d, 0x0401);
174 lcd_write_reg(0x0e, 0x321e); 211 lcd_write_reg(0x0e, 0x321e);
175 lcd_write_reg(0x01, 0x0113); 212 lcd_write_reg(0x01, 0x0313);
176 lcd_write_reg(0x02, 0x0700); 213 lcd_write_reg(0x02, 0x0700);
177 lcd_write_reg(0x05, 0x9018); 214 lcd_write_reg(0x05, 0x9038);
178 lcd_write_reg(0x06, 0x0000); 215 lcd_write_reg(0x06, 0x0000);
179 lcd_write_reg(0x0b, 0x4000); 216 lcd_write_reg(0x0b, 0x4000);
180 217
@@ -189,7 +226,7 @@ void lcd_init_device(void)
189 lcd_write_reg(0x35,0x0704); 226 lcd_write_reg(0x35,0x0704);
190 lcd_write_reg(0x36,0x0407); 227 lcd_write_reg(0x36,0x0407);
191 lcd_write_reg(0x37,0x0503); 228 lcd_write_reg(0x37,0x0503);
192 lcd_write_reg(0x0f,0x0000); 229 lcd_write_reg(0x0f,0x0002);
193 lcd_write_reg(0x11,0x0000); 230 lcd_write_reg(0x11,0x0000);
194 lcd_write_reg(0x14,0x9f00); 231 lcd_write_reg(0x14,0x9f00);
195 lcd_write_reg(0x15,0x5c00); 232 lcd_write_reg(0x15,0x5c00);
@@ -290,10 +327,7 @@ void lcd_update_rect(int x, int y, int width, int height)
290 } 327 }
291 328
292 /* reset update window */ 329 /* reset update window */
293 /* horiz ram addr: 0 - 175 */ 330 lcd_write_reg(R_HORIZ_RAM_ADDR_POS, 0x7f00);
294 lcd_write_reg(R_HORIZ_RAM_ADDR_POS, 0xaf00); 331 lcd_write_reg(R_VERT_RAM_ADDR_POS, 0x9f00);
295
296 /* vert ram addr: 0 - 219 */
297 lcd_write_reg(R_VERT_RAM_ADDR_POS, 0xdb00);
298 } 332 }
299} 333}