summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2007-04-03 21:22:48 +0000
committerJens Arnold <amiconn@rockbox.org>2007-04-03 21:22:48 +0000
commit61350bf91cbe18c5a6d390c1d0140326031703e1 (patch)
tree96635040902335cf2cc1d511782b769778ffa436
parent771133eb12ef68d984992d6aed19707b3075a9dd (diff)
downloadrockbox-61350bf91cbe18c5a6d390c1d0140326031703e1.tar.gz
rockbox-61350bf91cbe18c5a6d390c1d0140326031703e1.zip
Remove old reference code, better match Old-LCD init with datasheet, and a bit of optimisation.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13013 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/sh/archos/player/lcd-player.c65
1 files changed, 9 insertions, 56 deletions
diff --git a/firmware/target/sh/archos/player/lcd-player.c b/firmware/target/sh/archos/player/lcd-player.c
index 31ff802531..96116d36cb 100644
--- a/firmware/target/sh/archos/player/lcd-player.c
+++ b/firmware/target/sh/archos/player/lcd-player.c
@@ -29,6 +29,7 @@
29#define OLD_LCD_CGRAM ((char)0x80) /* Character generator (patterns) */ 29#define OLD_LCD_CGRAM ((char)0x80) /* Character generator (patterns) */
30#define OLD_LCD_ICONRAM ((char)0xE0) 30#define OLD_LCD_ICONRAM ((char)0xE0)
31#define OLD_LCD_CONTRAST_SET ((char)0xA8) 31#define OLD_LCD_CONTRAST_SET ((char)0xA8)
32#define OLD_LCD_NOP ((char)0x00)
32#define OLD_LCD_SYSTEM_SET ((char)0x60) 33#define OLD_LCD_SYSTEM_SET ((char)0x60)
33#define OLD_LCD_SET_POWER_SAVE_OSC_CONTROL ((char)0x40) 34#define OLD_LCD_SET_POWER_SAVE_OSC_CONTROL ((char)0x40)
34#define OLD_LCD_SET_POWER_CONTROL ((char)0x50) 35#define OLD_LCD_SET_POWER_CONTROL ((char)0x50)
@@ -38,6 +39,7 @@
38#define NEW_LCD_CGRAM ((char)0xC0) /* Character generator (patterns) */ 39#define NEW_LCD_CGRAM ((char)0xC0) /* Character generator (patterns) */
39#define NEW_LCD_ICONRAM ((char)0x40) 40#define NEW_LCD_ICONRAM ((char)0x40)
40#define NEW_LCD_CONTRAST_SET ((char)0x50) 41#define NEW_LCD_CONTRAST_SET ((char)0x50)
42#define NEW_LCD_NOP ((char)0x00)
41#define NEW_LCD_FUNCTION_SET ((char)0x10) 43#define NEW_LCD_FUNCTION_SET ((char)0x10)
42#define NEW_LCD_SET_POWER_SAVE_OSC_CONTROL ((char)0x0c) 44#define NEW_LCD_SET_POWER_SAVE_OSC_CONTROL ((char)0x0c)
43#define NEW_LCD_SET_POWER_CONTROL_REG ((char)0x20) 45#define NEW_LCD_SET_POWER_CONTROL_REG ((char)0x20)
@@ -112,6 +114,11 @@ void lcd_init_device(void)
112{ 114{
113 unsigned char data_vector[64]; 115 unsigned char data_vector[64];
114 116
117 /* LCD init for cold start */
118 PBCR2 &= 0xff00; /* Set PB0..PB3 to GPIO */
119 or_b(0x0f, &PBDRL); /* ... high */
120 or_b(0x0f, &PBIORL); /* ... and output */
121
115 new_lcd = is_new_player(); 122 new_lcd = is_new_player();
116 123
117 if (new_lcd) 124 if (new_lcd)
@@ -121,11 +128,6 @@ void lcd_init_device(void)
121 lcd_cgram = NEW_LCD_CGRAM; 128 lcd_cgram = NEW_LCD_CGRAM;
122 lcd_iconram = NEW_LCD_ICONRAM; 129 lcd_iconram = NEW_LCD_ICONRAM;
123 130
124 /* LCD init for cold start */
125 PBCR2 &= 0xff00; /* Set PB0..PB3 to GPIO */
126 or_b(0x0f, &PBDRL); /* ... high */
127 or_b(0x0f, &PBIORL); /* ... and output */
128
129 lcd_write_command(NEW_LCD_FUNCTION_SET|1); /* CGRAM selected */ 131 lcd_write_command(NEW_LCD_FUNCTION_SET|1); /* CGRAM selected */
130 lcd_write_command_e(NEW_LCD_CONTRAST_SET, 0x08); 132 lcd_write_command_e(NEW_LCD_CONTRAST_SET, 0x08);
131 lcd_write_command(NEW_LCD_SET_POWER_SAVE_OSC_CONTROL|2); 133 lcd_write_command(NEW_LCD_SET_POWER_SAVE_OSC_CONTROL|2);
@@ -152,12 +154,7 @@ void lcd_init_device(void)
152 lcd_cgram = OLD_LCD_CGRAM; 154 lcd_cgram = OLD_LCD_CGRAM;
153 lcd_iconram = OLD_LCD_ICONRAM; 155 lcd_iconram = OLD_LCD_ICONRAM;
154 156
155#if 1 157 lcd_write_command(OLD_LCD_NOP);
156 /* LCD init for cold start */
157 PBCR2 &= 0xff00; /* Set PB0..PB3 to GPIO */
158 or_b(0x0f, &PBDRL); /* ... high */
159 or_b(0x0f, &PBIORL); /* ... and output */
160
161 lcd_write_command(OLD_LCD_SYSTEM_SET|1); /* CGRAM selected */ 158 lcd_write_command(OLD_LCD_SYSTEM_SET|1); /* CGRAM selected */
162 lcd_write_command(OLD_LCD_SET_POWER_SAVE_OSC_CONTROL|2); 159 lcd_write_command(OLD_LCD_SET_POWER_SAVE_OSC_CONTROL|2);
163 /* oscillator on */ 160 /* oscillator on */
@@ -180,52 +177,8 @@ void lcd_init_device(void)
180 lcd_write_command(OLD_LCD_ICONRAM + 0x10); 177 lcd_write_command(OLD_LCD_ICONRAM + 0x10);
181 lcd_write_data(data_vector, 13); 178 lcd_write_data(data_vector, 13);
182 179
180 sleep(HZ/10);
183 lcd_write_command(OLD_LCD_SET_DISPLAY_CONTROL|1); /* display on */ 181 lcd_write_command(OLD_LCD_SET_DISPLAY_CONTROL|1); /* display on */
184#else
185 /* archos look-alike code, left here for reference. As soon as the
186 * rockbox version is confirmed working, this will go away */
187 {
188 int i;
189
190 PBCR2 &= 0xc000;
191 PBIOR |= 0x000f;
192 PBDR |= 0x0002;
193 PBDR |= 0x0001;
194 PBDR |= 0x0004;
195 PBDR |= 0x0008;
196
197 for (i=0; i<200; i++) asm volatile ("nop"); /* wait 100 us */
198
199 PBDR &= 0xfffd; /* CS low (assert) */
200
201 for (i=0; i<100; i++) asm volatile ("nop"); /* wait 50 us */
202
203 lcd_write_command(OLD_LCD_SYSTEM_SET|1);
204 lcd_write_command(OLD_LCD_SET_POWER_SAVE_OSC_CONTROL|2);
205 lcd_write_command(OLD_LCD_SET_POWER_CONTROL|7);
206
207 memset(data_vector, 0x24, 13);
208 lcd_write_command(OLD_LCD_DDRAM); /* Set DDRAM address */
209 lcd_write_data(data_vector, 13); /* all spaces */
210 lcd_write_command(OLD_LCD_DDRAM + 0x10);
211 lcd_write_data(data_vector, 13);
212 lcd_write_command(OLD_LCD_DDRAM + 0x20);
213 lcd_write_data(data_vector, 13);
214
215 memset(data_vector, 0, 32);
216 lcd_write_command(OLD_LCD_CGRAM); /* Set CGRAM address */
217 lcd_write_data(data_vector, 32); /* zero out */
218 lcd_write_command(OLD_LCD_ICONRAM); /* Set ICONRAM address */
219 lcd_write_data(data_vector, 13); /* zero out */
220 lcd_write_command(OLD_LCD_ICONRAM + 0x10);
221 lcd_write_data(data_vector, 13);
222
223 for (i=0; i<300000; i++) asm volatile ("nop"); /* wait 150 ms */
224
225 lcd_write_command(OLD_LCD_SET_DISPLAY_CONTROL|1);
226 lcd_write_command_e(OLD_LCD_CONTRAST_SET, 0); /* Set contrast */
227 }
228#endif
229 } 182 }
230 lcd_set_contrast(lcd_default_contrast()); 183 lcd_set_contrast(lcd_default_contrast());
231} 184}