diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-12-12 15:16:55 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-12-12 15:16:55 +0000 |
commit | eadff408632571c93e39966e46d0c5736d7a6aa9 (patch) | |
tree | 30a17b3fbe7a70a4312f79f3d1b749f898317f3e | |
parent | 335df1d0403013879b3237b9997316d7ab8bbfbf (diff) | |
download | rockbox-eadff408632571c93e39966e46d0c5736d7a6aa9.tar.gz rockbox-eadff408632571c93e39966e46d0c5736d7a6aa9.zip |
FS#11807 - Major speedup of iPod nano 2G. Part 3: Unify different write commands. No change in speed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28812 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c | 265 |
1 files changed, 90 insertions, 175 deletions
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c index 5eabfdb463..071b68fde3 100644 --- a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c +++ b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c | |||
@@ -67,149 +67,82 @@ static bool lcd_ispowered; | |||
67 | #ifdef HAVE_LCD_SLEEP | 67 | #ifdef HAVE_LCD_SLEEP |
68 | 68 | ||
69 | #define SLEEP 0 | 69 | #define SLEEP 0 |
70 | #define CMD8 1 | 70 | #define CMD16 1 |
71 | #define CMD16 2 | 71 | #define DATA16 2 |
72 | #define DATA8 3 | ||
73 | #define DATA16 4 | ||
74 | 72 | ||
75 | unsigned short lcd_init_sequence_0[] = { | 73 | unsigned short lcd_init_sequence_0[] = { |
76 | CMD16, 0x00a4, | 74 | CMD16, 0x00a4, DATA16, 0x0001, |
77 | DATA16, 0x0001, | ||
78 | SLEEP, 0x0000, | 75 | SLEEP, 0x0000, |
79 | CMD16, 0x0001, | 76 | CMD16, 0x0001, DATA16, 0x0100, |
80 | DATA16, 0x0100, | 77 | CMD16, 0x0002, DATA16, 0x0300, |
81 | CMD16, 0x0002, | 78 | CMD16, 0x0003, DATA16, 0x1230, |
82 | DATA16, 0x0300, | 79 | CMD16, 0x0008, DATA16, 0x0404, |
83 | CMD16, 0x0003, | 80 | CMD16, 0x0008, DATA16, 0x0404, |
84 | DATA16, 0x1230, | 81 | CMD16, 0x000e, DATA16, 0x0010, |
85 | CMD16, 0x0008, | 82 | CMD16, 0x0070, DATA16, 0x1000, |
86 | DATA16, 0x0404, | 83 | CMD16, 0x0071, DATA16, 0x0001, |
87 | CMD16, 0x0008, | 84 | CMD16, 0x0030, DATA16, 0x0002, |
88 | DATA16, 0x0404, | 85 | CMD16, 0x0031, DATA16, 0x0400, |
89 | CMD16, 0x000e, | 86 | CMD16, 0x0032, DATA16, 0x0007, |
90 | DATA16, 0x0010, | 87 | CMD16, 0x0033, DATA16, 0x0500, |
91 | CMD16, 0x0070, | 88 | CMD16, 0x0034, DATA16, 0x0007, |
92 | DATA16, 0x1000, | 89 | CMD16, 0x0035, DATA16, 0x0703, |
93 | CMD16, 0x0071, | 90 | CMD16, 0x0036, DATA16, 0x0507, |
94 | DATA16, 0x0001, | 91 | CMD16, 0x0037, DATA16, 0x0005, |
95 | CMD16, 0x0030, | 92 | CMD16, 0x0038, DATA16, 0x0407, |
96 | DATA16, 0x0002, | 93 | CMD16, 0x0039, DATA16, 0x000e, |
97 | CMD16, 0x0031, | 94 | CMD16, 0x0040, DATA16, 0x0202, |
98 | DATA16, 0x0400, | 95 | CMD16, 0x0041, DATA16, 0x0003, |
99 | CMD16, 0x0032, | 96 | CMD16, 0x0042, DATA16, 0x0000, |
100 | DATA16, 0x0007, | 97 | CMD16, 0x0043, DATA16, 0x0200, |
101 | CMD16, 0x0033, | 98 | CMD16, 0x0044, DATA16, 0x0707, |
102 | DATA16, 0x0500, | 99 | CMD16, 0x0045, DATA16, 0x0407, |
103 | CMD16, 0x0034, | 100 | CMD16, 0x0046, DATA16, 0x0505, |
104 | DATA16, 0x0007, | 101 | CMD16, 0x0047, DATA16, 0x0002, |
105 | CMD16, 0x0035, | 102 | CMD16, 0x0048, DATA16, 0x0004, |
106 | DATA16, 0x0703, | 103 | CMD16, 0x0049, DATA16, 0x0004, |
107 | CMD16, 0x0036, | 104 | CMD16, 0x0060, DATA16, 0x0202, |
108 | DATA16, 0x0507, | 105 | CMD16, 0x0061, DATA16, 0x0003, |
109 | CMD16, 0x0037, | 106 | CMD16, 0x0062, DATA16, 0x0000, |
110 | DATA16, 0x0005, | 107 | CMD16, 0x0063, DATA16, 0x0200, |
111 | CMD16, 0x0038, | 108 | CMD16, 0x0064, DATA16, 0x0707, |
112 | DATA16, 0x0407, | 109 | CMD16, 0x0065, DATA16, 0x0407, |
113 | CMD16, 0x0039, | 110 | CMD16, 0x0066, DATA16, 0x0505, |
114 | DATA16, 0x000e, | 111 | CMD16, 0x0068, DATA16, 0x0004, |
115 | CMD16, 0x0040, | 112 | CMD16, 0x0069, DATA16, 0x0004, |
116 | DATA16, 0x0202, | 113 | CMD16, 0x0007, DATA16, 0x0001, |
117 | CMD16, 0x0041, | 114 | CMD16, 0x0018, DATA16, 0x0001, |
118 | DATA16, 0x0003, | 115 | CMD16, 0x0010, DATA16, 0x1690, |
119 | CMD16, 0x0042, | 116 | CMD16, 0x0011, DATA16, 0x0100, |
120 | DATA16, 0x0000, | 117 | CMD16, 0x0012, DATA16, 0x0117, |
121 | CMD16, 0x0043, | 118 | CMD16, 0x0013, DATA16, 0x0f80, |
122 | DATA16, 0x0200, | 119 | CMD16, 0x0012, DATA16, 0x0137, |
123 | CMD16, 0x0044, | 120 | CMD16, 0x0020, DATA16, 0x0000, |
124 | DATA16, 0x0707, | 121 | CMD16, 0x0021, DATA16, 0x0000, |
125 | CMD16, 0x0045, | 122 | CMD16, 0x0050, DATA16, 0x0000, |
126 | DATA16, 0x0407, | 123 | CMD16, 0x0051, DATA16, 0x00af, |
127 | CMD16, 0x0046, | 124 | CMD16, 0x0052, DATA16, 0x0000, |
128 | DATA16, 0x0505, | 125 | CMD16, 0x0053, DATA16, 0x0083, |
129 | CMD16, 0x0047, | 126 | CMD16, 0x0090, DATA16, 0x0003, |
130 | DATA16, 0x0002, | 127 | CMD16, 0x0091, DATA16, 0x0000, |
131 | CMD16, 0x0048, | 128 | CMD16, 0x0092, DATA16, 0x0101, |
132 | DATA16, 0x0004, | 129 | CMD16, 0x0098, DATA16, 0x0400, |
133 | CMD16, 0x0049, | 130 | CMD16, 0x0099, DATA16, 0x1302, |
134 | DATA16, 0x0004, | 131 | CMD16, 0x009a, DATA16, 0x0202, |
135 | CMD16, 0x0060, | 132 | CMD16, 0x009b, DATA16, 0x0200, |
136 | DATA16, 0x0202, | ||
137 | CMD16, 0x0061, | ||
138 | DATA16, 0x0003, | ||
139 | CMD16, 0x0062, | ||
140 | DATA16, 0x0000, | ||
141 | CMD16, 0x0063, | ||
142 | DATA16, 0x0200, | ||
143 | CMD16, 0x0064, | ||
144 | DATA16, 0x0707, | ||
145 | CMD16, 0x0065, | ||
146 | DATA16, 0x0407, | ||
147 | CMD16, 0x0066, | ||
148 | DATA16, 0x0505, | ||
149 | CMD16, 0x0068, | ||
150 | DATA16, 0x0004, | ||
151 | CMD16, 0x0069, | ||
152 | DATA16, 0x0004, | ||
153 | CMD16, 0x0007, | ||
154 | DATA16, 0x0001, | ||
155 | CMD16, 0x0018, | ||
156 | DATA16, 0x0001, | ||
157 | CMD16, 0x0010, | ||
158 | DATA16, 0x1690, | ||
159 | CMD16, 0x0011, | ||
160 | DATA16, 0x0100, | ||
161 | CMD16, 0x0012, | ||
162 | DATA16, 0x0117, | ||
163 | CMD16, 0x0013, | ||
164 | DATA16, 0x0f80, | ||
165 | CMD16, 0x0012, | ||
166 | DATA16, 0x0137, | ||
167 | CMD16, 0x0020, | ||
168 | DATA16, 0x0000, | ||
169 | CMD16, 0x0021, | ||
170 | DATA16, 0x0000, | ||
171 | CMD16, 0x0050, | ||
172 | DATA16, 0x0000, | ||
173 | CMD16, 0x0051, | ||
174 | DATA16, 0x00af, | ||
175 | CMD16, 0x0052, | ||
176 | DATA16, 0x0000, | ||
177 | CMD16, 0x0053, | ||
178 | DATA16, 0x0083, | ||
179 | CMD16, 0x0090, | ||
180 | DATA16, 0x0003, | ||
181 | CMD16, 0x0091, | ||
182 | DATA16, 0x0000, | ||
183 | CMD16, 0x0092, | ||
184 | DATA16, 0x0101, | ||
185 | CMD16, 0x0098, | ||
186 | DATA16, 0x0400, | ||
187 | CMD16, 0x0099, | ||
188 | DATA16, 0x1302, | ||
189 | CMD16, 0x009a, | ||
190 | DATA16, 0x0202, | ||
191 | CMD16, 0x009b, | ||
192 | DATA16, 0x0200, | ||
193 | SLEEP, 0x0000, | 133 | SLEEP, 0x0000, |
194 | CMD16, 0x0007, | 134 | CMD16, 0x0007, DATA16, 0x0021, |
195 | DATA16, 0x0021, | 135 | CMD16, 0x0012, DATA16, 0x0137, |
196 | CMD16, 0x0012, | ||
197 | DATA16, 0x0137, | ||
198 | SLEEP, 0x0000, | 136 | SLEEP, 0x0000, |
199 | CMD16, 0x0007, | 137 | CMD16, 0x0007, DATA16, 0x0021, |
200 | DATA16, 0x0021, | 138 | CMD16, 0x0012, DATA16, 0x1137, |
201 | CMD16, 0x0012, | ||
202 | DATA16, 0x1137, | ||
203 | SLEEP, 0x0000, | 139 | SLEEP, 0x0000, |
204 | CMD16, 0x0007, | 140 | CMD16, 0x0007, DATA16, 0x0233, |
205 | DATA16, 0x0233, | ||
206 | }; | 141 | }; |
207 | 142 | ||
208 | unsigned short lcd_init_sequence_1[] = { | 143 | unsigned short lcd_init_sequence_1[] = { |
209 | CMD8, 0x11, | 144 | CMD16, 0x0011, DATA16, 0x0000, |
210 | DATA16, 0x00, | 145 | CMD16, 0x0029, DATA16, 0x0000, |
211 | CMD8, 0x29, | ||
212 | DATA16, 0x00, | ||
213 | }; | 146 | }; |
214 | 147 | ||
215 | 148 | ||
@@ -231,24 +164,12 @@ static inline void s5l_lcd_write_cmd(unsigned short cmd) | |||
231 | LCD_WCMD = cmd; | 164 | LCD_WCMD = cmd; |
232 | } | 165 | } |
233 | 166 | ||
234 | static inline void s5l_lcd_write_wcmd(unsigned short cmd) | ||
235 | { | ||
236 | while (LCD_STATUS & 0x10); | ||
237 | LCD_WCMD = cmd; | ||
238 | } | ||
239 | |||
240 | static inline void s5l_lcd_write_data(unsigned short data) | 167 | static inline void s5l_lcd_write_data(unsigned short data) |
241 | { | 168 | { |
242 | while (LCD_STATUS & 0x10); | 169 | while (LCD_STATUS & 0x10); |
243 | LCD_WDATA = data; | 170 | LCD_WDATA = data; |
244 | } | 171 | } |
245 | 172 | ||
246 | static inline void s5l_lcd_write_wdata(unsigned short data) | ||
247 | { | ||
248 | while (LCD_STATUS & 0x10); | ||
249 | LCD_WDATA = data; | ||
250 | } | ||
251 | |||
252 | /*** hardware configuration ***/ | 173 | /*** hardware configuration ***/ |
253 | 174 | ||
254 | int lcd_default_contrast(void) | 175 | int lcd_default_contrast(void) |
@@ -323,17 +244,11 @@ void lcd_wakeup(void) | |||
323 | { | 244 | { |
324 | switch(lcd_init_sequence[i]) | 245 | switch(lcd_init_sequence[i]) |
325 | { | 246 | { |
326 | case CMD8: | ||
327 | s5l_lcd_write_cmd(lcd_init_sequence[i+1]); | ||
328 | break; | ||
329 | case DATA8: | ||
330 | s5l_lcd_write_data(lcd_init_sequence[i+1]); | ||
331 | break; | ||
332 | case CMD16: | 247 | case CMD16: |
333 | s5l_lcd_write_wcmd(lcd_init_sequence[i+1]); | 248 | s5l_lcd_write_cmd(lcd_init_sequence[i+1]); |
334 | break; | 249 | break; |
335 | case DATA16: | 250 | case DATA16: |
336 | s5l_lcd_write_wdata(lcd_init_sequence[i+1]); | 251 | s5l_lcd_write_data(lcd_init_sequence[i+1]); |
337 | break; | 252 | break; |
338 | case SLEEP: | 253 | case SLEEP: |
339 | sleep(lcd_init_sequence[i+1]); | 254 | sleep(lcd_init_sequence[i+1]); |
@@ -359,24 +274,24 @@ void lcd_shutdown(void) | |||
359 | 274 | ||
360 | if (lcd_type == 0) | 275 | if (lcd_type == 0) |
361 | { | 276 | { |
362 | s5l_lcd_write_cmd_data(R_DISPLAY_CONTROL_1, 0x232); | 277 | s5l_lcd_write_cmd_data(R_DISPLAY_CONTROL_1, 0x0232); |
363 | s5l_lcd_write_cmd_data(R_POWER_CONTROL_3, 0x1137); | 278 | s5l_lcd_write_cmd_data(R_POWER_CONTROL_3 , 0x1137); |
364 | s5l_lcd_write_cmd_data(R_DISPLAY_CONTROL_1, 0x201); | 279 | s5l_lcd_write_cmd_data(R_DISPLAY_CONTROL_1, 0x0201); |
365 | s5l_lcd_write_cmd_data(R_POWER_CONTROL_3, 0x137); | 280 | s5l_lcd_write_cmd_data(R_POWER_CONTROL_3 , 0x0137); |
366 | s5l_lcd_write_cmd_data(R_DISPLAY_CONTROL_1, 0x200); | 281 | s5l_lcd_write_cmd_data(R_DISPLAY_CONTROL_1, 0x0200); |
367 | s5l_lcd_write_cmd_data(R_POWER_CONTROL_1, 0x680); | 282 | s5l_lcd_write_cmd_data(R_POWER_CONTROL_1 , 0x0680); |
368 | s5l_lcd_write_cmd_data(R_POWER_CONTROL_2, 0x160); | 283 | s5l_lcd_write_cmd_data(R_POWER_CONTROL_2 , 0x0160); |
369 | s5l_lcd_write_cmd_data(R_POWER_CONTROL_3, 0x127); | 284 | s5l_lcd_write_cmd_data(R_POWER_CONTROL_3 , 0x0127); |
370 | s5l_lcd_write_cmd_data(R_POWER_CONTROL_1, 0x600); | 285 | s5l_lcd_write_cmd_data(R_POWER_CONTROL_1 , 0x0600); |
371 | } | 286 | } |
372 | else | 287 | else |
373 | { | 288 | { |
374 | s5l_lcd_write_cmd(R_DISPLAY_OFF); | 289 | s5l_lcd_write_cmd(R_DISPLAY_OFF); |
375 | s5l_lcd_write_wdata(0); | 290 | s5l_lcd_write_data(0); |
376 | s5l_lcd_write_wdata(0); | 291 | s5l_lcd_write_data(0); |
377 | s5l_lcd_write_cmd(R_SLEEP_IN); | 292 | s5l_lcd_write_cmd(R_SLEEP_IN); |
378 | s5l_lcd_write_wdata(0); | 293 | s5l_lcd_write_data(0); |
379 | s5l_lcd_write_wdata(0); | 294 | s5l_lcd_write_data(0); |
380 | } | 295 | } |
381 | 296 | ||
382 | PWRCONEXT |= 0x80; | 297 | PWRCONEXT |= 0x80; |
@@ -449,12 +364,12 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
449 | s5l_lcd_write_cmd(R_WRITE_DATA_TO_GRAM); | 364 | s5l_lcd_write_cmd(R_WRITE_DATA_TO_GRAM); |
450 | } else { | 365 | } else { |
451 | s5l_lcd_write_cmd(R_COLUMN_ADDR_SET); | 366 | s5l_lcd_write_cmd(R_COLUMN_ADDR_SET); |
452 | s5l_lcd_write_wdata(x0); /* Start column */ | 367 | s5l_lcd_write_data(x0); /* Start column */ |
453 | s5l_lcd_write_wdata(x1); /* End column */ | 368 | s5l_lcd_write_data(x1); /* End column */ |
454 | 369 | ||
455 | s5l_lcd_write_cmd(R_ROW_ADDR_SET); | 370 | s5l_lcd_write_cmd(R_ROW_ADDR_SET); |
456 | s5l_lcd_write_wdata(y0); /* Start row */ | 371 | s5l_lcd_write_data(y0); /* Start row */ |
457 | s5l_lcd_write_wdata(y1); /* End row */ | 372 | s5l_lcd_write_data(y1); /* End row */ |
458 | 373 | ||
459 | s5l_lcd_write_cmd(R_MEMORY_WRITE); | 374 | s5l_lcd_write_cmd(R_MEMORY_WRITE); |
460 | } | 375 | } |
@@ -546,12 +461,12 @@ void lcd_blit_yuv(unsigned char * const src[3], | |||
546 | s5l_lcd_write_cmd(R_WRITE_DATA_TO_GRAM); | 461 | s5l_lcd_write_cmd(R_WRITE_DATA_TO_GRAM); |
547 | } else { | 462 | } else { |
548 | s5l_lcd_write_cmd(R_COLUMN_ADDR_SET); | 463 | s5l_lcd_write_cmd(R_COLUMN_ADDR_SET); |
549 | s5l_lcd_write_wdata(x0); /* Start column */ | 464 | s5l_lcd_write_data(x0); /* Start column */ |
550 | s5l_lcd_write_wdata(x1); /* End column */ | 465 | s5l_lcd_write_data(x1); /* End column */ |
551 | 466 | ||
552 | s5l_lcd_write_cmd(R_ROW_ADDR_SET); | 467 | s5l_lcd_write_cmd(R_ROW_ADDR_SET); |
553 | s5l_lcd_write_wdata(y0); /* Start row */ | 468 | s5l_lcd_write_data(y0); /* Start row */ |
554 | s5l_lcd_write_wdata(y1); /* End row */ | 469 | s5l_lcd_write_data(y1); /* End row */ |
555 | 470 | ||
556 | s5l_lcd_write_cmd(R_MEMORY_WRITE); | 471 | s5l_lcd_write_cmd(R_MEMORY_WRITE); |
557 | } | 472 | } |