summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-01-14 18:47:00 +0000
committerJens Arnold <amiconn@rockbox.org>2008-01-14 18:47:00 +0000
commitb30ca8ca5ab6c8ea27b8fe1f5fb38ebad09b7e62 (patch)
treec1af2e80ae597196cb0d5114f4128d2d6b18e2d1
parentfeefc90a2ac63fb5272515f76a5b0231688224f0 (diff)
downloadrockbox-b30ca8ca5ab6c8ea27b8fe1f5fb38ebad09b7e62.tar.gz
rockbox-b30ca8ca5ab6c8ea27b8fe1f5fb38ebad09b7e62.zip
* Apply a a recent, small optimisation from the archos bitmap lcd driver to the charcell driver, and fix comments. * Make the optimisation more safe, and apply that fix to the bitmap driver as well.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16089 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/sh/archos/lcd-as-archos-bitmap.S4
-rw-r--r--firmware/target/sh/archos/player/lcd-as-player.S38
2 files changed, 19 insertions, 23 deletions
diff --git a/firmware/target/sh/archos/lcd-as-archos-bitmap.S b/firmware/target/sh/archos/lcd-as-archos-bitmap.S
index ae7b7f85cc..f2ac525976 100644
--- a/firmware/target/sh/archos/lcd-as-archos-bitmap.S
+++ b/firmware/target/sh/archos/lcd-as-archos-bitmap.S
@@ -88,7 +88,7 @@ _lcd_write_command:
88 * If so, we must disable the interrupt here. */ 88 * If so, we must disable the interrupt here. */
89 89
90 mov.b @r3, r0 /* r0 = PBDRL */ 90 mov.b @r3, r0 /* r0 = PBDRL */
91 mov r4, r5 /* (fake) end address = current address */ 91 mov #0, r5 /* fake end address - stop after first iteration */
92 or #(LCD_SD), r0 /* r0 |= LCD_SD */ 92 or #(LCD_SD), r0 /* r0 |= LCD_SD */
93 and #(~(LCD_CS|LCD_DS|LCD_SC)), r0 /* r0 &= ~(LCD_CS|LCD_DS|LCD_SC) */ 93 and #(~(LCD_CS|LCD_DS|LCD_SC)), r0 /* r0 &= ~(LCD_CS|LCD_DS|LCD_SC) */
94 94
@@ -320,7 +320,7 @@ _lcd_grey_data:
320 320
321 sub r10, r8 321 sub r10, r8
322 mov.l r8, @(4,r5) 322 mov.l r8, @(4,r5)
323 323
324 add #8, r5 324 add #8, r5
325 cmp/hi r4, r6 325 cmp/hi r4, r6
326 bt .greyloop 326 bt .greyloop
diff --git a/firmware/target/sh/archos/player/lcd-as-player.S b/firmware/target/sh/archos/player/lcd-as-player.S
index 8dc1219e62..6c19e1ab2f 100644
--- a/firmware/target/sh/archos/player/lcd-as-player.S
+++ b/firmware/target/sh/archos/player/lcd-as-player.S
@@ -82,7 +82,7 @@
82_lcd_write_command: 82_lcd_write_command:
83 mov.l .lcdr, r3 /* put lcd data port address in r3 */ 83 mov.l .lcdr, r3 /* put lcd data port address in r3 */
84 mov r4, r1 /* copy data byte to r1 */ 84 mov r4, r1 /* copy data byte to r1 */
85 mov #1, r5 /* set byte count to 1 (!) */ 85 mov #0, r5 /* fake end address - stop after first iteration */
86 86
87 /* This code will fail if an interrupt changes the contents of PBDRL. 87 /* This code will fail if an interrupt changes the contents of PBDRL.
88 * If so, we must disable the interrupt here. */ 88 * If so, we must disable the interrupt here. */
@@ -110,7 +110,7 @@ _lcd_write_command:
110 * r1 - command/data byte (copied) 110 * r1 - command/data byte (copied)
111 * r2 - precalculated port value (CS, DS and SC low, SD high) 111 * r2 - precalculated port value (CS, DS and SC low, SD high)
112 * r3 - lcd port address 112 * r3 - lcd port address
113 * r5 - 1 (byte count for reuse of the loop in _lcd_write_data) 113 * r5 - fake end address
114 * r6 - data byte (saved) 114 * r6 - data byte (saved)
115 * r7 - saved pr 115 * r7 - saved pr
116 */ 116 */
@@ -119,7 +119,7 @@ _lcd_write_command_e:
119 mov.l .lcdr, r3 /* put lcd data port address in r3 */ 119 mov.l .lcdr, r3 /* put lcd data port address in r3 */
120 mov r4, r1 /* copy data byte to r1 */ 120 mov r4, r1 /* copy data byte to r1 */
121 mov r5, r6 121 mov r5, r6
122 mov #1, r5 /* set byte count to 1 (!) */ 122 mov #0, r5 /* fake end address - stop after first iteration */
123 123
124 /* This code will fail if an interrupt changes the contents of PBDRL. 124 /* This code will fail if an interrupt changes the contents of PBDRL.
125 * If so, we must disable the interrupt here. */ 125 * If so, we must disable the interrupt here. */
@@ -134,7 +134,6 @@ _lcd_write_command_e:
134 134
135 lds r7, pr 135 lds r7, pr
136 mov r6, r1 136 mov r6, r1
137 mov #1, r5 /* set byte count to 1 (!) */
138 or #(LCD_DS|LCD_SD), r0 /* r0 |= LCD_DS|LCD_SD */ 137 or #(LCD_DS|LCD_SD), r0 /* r0 |= LCD_DS|LCD_SD */
139 and #(~(LCD_CS|LCD_SC)), r0 /* r0 &= ~(LCD_CS|LCD_SC) */ 138 and #(~(LCD_CS|LCD_SC)), r0 /* r0 &= ~(LCD_CS|LCD_SC) */
140 bra .single_transfer /* jump into the transfer loop */ 139 bra .single_transfer /* jump into the transfer loop */
@@ -156,14 +155,15 @@ _lcd_write_command_e:
156 * Register usage: 155 * Register usage:
157 * r0 - scratch 156 * r0 - scratch
158 * r1 - current data byte 157 * r1 - current data byte
159 * r2 - precalculated port value (CS and SC low, DS and SD high), 158 * r2 - precalculated port value (CS and SC low, DS and SD high)
160 * negated (neg)!
161 * r3 - lcd port address 159 * r3 - lcd port address
160 * r4 - current address
161 * r5 - end address
162 */ 162 */
163 163
164_lcd_write_data: 164_lcd_write_data:
165 mov.l .lcdr, r3 /* put lcd data port address in r3 */ 165 mov.l .lcdr, r3 /* put lcd data port address in r3 */
166 nop /* align here */ 166 add r4, r5 /* end address */
167 167
168 /* This code will fail if an interrupt changes the contents of PBDRL. 168 /* This code will fail if an interrupt changes the contents of PBDRL.
169 * If so, we must disable the interrupt here. If disabling interrupts 169 * If so, we must disable the interrupt here. If disabling interrupts
@@ -189,7 +189,7 @@ _lcd_write_data:
189 mov r2, r0 /* copy precalculated port value */ 189 mov r2, r0 /* copy precalculated port value */
190 bt 1f /* data bit = 1? */ 190 bt 1f /* data bit = 1? */
191 and #(~LCD_SD), r0 /* no: r0 &= ~LCD_SD */ 191 and #(~LCD_SD), r0 /* no: r0 &= ~LCD_SD */
192 1: 1921:
193 shll r1 /* next shift here for alignment */ 193 shll r1 /* next shift here for alignment */
194 mov.b r0, @r3 /* set data to port */ 194 mov.b r0, @r3 /* set data to port */
195 or #(LCD_SC), r0 /* rise SC (independent of SD level) */ 195 or #(LCD_SC), r0 /* rise SC (independent of SD level) */
@@ -198,7 +198,7 @@ _lcd_write_data:
198 mov r2, r0 198 mov r2, r0
199 bt 1f 199 bt 1f
200 and #(~LCD_SD), r0 200 and #(~LCD_SD), r0
201 1: 2011:
202 mov.b r0, @r3 202 mov.b r0, @r3
203 or #(LCD_SC), r0 203 or #(LCD_SC), r0
204 mov.b r0, @r3 204 mov.b r0, @r3
@@ -207,7 +207,7 @@ _lcd_write_data:
207 mov r2, r0 207 mov r2, r0
208 bt 1f 208 bt 1f
209 and #(~LCD_SD), r0 209 and #(~LCD_SD), r0
210 1: 2101:
211 shll r1 211 shll r1
212 mov.b r0, @r3 212 mov.b r0, @r3
213 or #(LCD_SC), r0 213 or #(LCD_SC), r0
@@ -216,7 +216,7 @@ _lcd_write_data:
216 mov r2, r0 216 mov r2, r0
217 bt 1f 217 bt 1f
218 and #(~LCD_SD), r0 218 and #(~LCD_SD), r0
219 1: 2191:
220 mov.b r0, @r3 220 mov.b r0, @r3
221 or #(LCD_SC), r0 221 or #(LCD_SC), r0
222 mov.b r0, @r3 222 mov.b r0, @r3
@@ -225,7 +225,7 @@ _lcd_write_data:
225 mov r2, r0 225 mov r2, r0
226 bt 1f 226 bt 1f
227 and #(~LCD_SD), r0 227 and #(~LCD_SD), r0
228 1: 2281:
229 shll r1 229 shll r1
230 mov.b r0, @r3 230 mov.b r0, @r3
231 or #(LCD_SC), r0 231 or #(LCD_SC), r0
@@ -234,7 +234,7 @@ _lcd_write_data:
234 mov r2, r0 234 mov r2, r0
235 bt 1f 235 bt 1f
236 and #(~LCD_SD), r0 236 and #(~LCD_SD), r0
237 1: 2371:
238 mov.b r0, @r3 238 mov.b r0, @r3
239 or #(LCD_SC), r0 239 or #(LCD_SC), r0
240 mov.b r0, @r3 240 mov.b r0, @r3
@@ -243,7 +243,7 @@ _lcd_write_data:
243 mov r2, r0 243 mov r2, r0
244 bt 1f 244 bt 1f
245 and #(~LCD_SD), r0 245 and #(~LCD_SD), r0
246 1: 2461:
247 shll r1 247 shll r1
248 mov.b r0, @r3 248 mov.b r0, @r3
249 or #(LCD_SC), r0 249 or #(LCD_SC), r0
@@ -252,14 +252,13 @@ _lcd_write_data:
252 mov r2, r0 252 mov r2, r0
253 bt 1f 253 bt 1f
254 and #(~LCD_SD), r0 254 and #(~LCD_SD), r0
255 1: 2551:
256 mov.b r0, @r3 256 mov.b r0, @r3
257 or #(LCD_SC), r0 257 or #(LCD_SC), r0
258 mov.b r0, @r3 258 mov.b r0, @r3
259 259
260 add #-1, r5 /* decrease byte count */ 260 cmp/hi r4, r5 /* some blocks left? */
261 tst r5, r5 /* r5 == 0 ? */ 261 bt .multi_transfer
262 bf .multi_transfer /* no: next iteration */
263 262
264 or #(LCD_CS|LCD_DS|LCD_SD|LCD_SC),r0 /* restore port */ 263 or #(LCD_CS|LCD_DS|LCD_SD|LCD_SC),r0 /* restore port */
265 rts 264 rts
@@ -271,6 +270,3 @@ _lcd_write_data:
271 .align 2 270 .align 2
272.lcdr: 271.lcdr:
273 .long LCDR 272 .long LCDR
274
275.end:
276 .size _lcd_write_command,.end-_lcd_write_command