1
0
Fork 0
forked from len0rd/rockbox

* 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
This commit is contained in:
Jens Arnold 2008-01-14 18:47:00 +00:00
parent feefc90a2a
commit b30ca8ca5a
2 changed files with 19 additions and 23 deletions

View file

@ -88,7 +88,7 @@ _lcd_write_command:
* If so, we must disable the interrupt here. */
mov.b @r3, r0 /* r0 = PBDRL */
mov r4, r5 /* (fake) end address = current address */
mov #0, r5 /* fake end address - stop after first iteration */
or #(LCD_SD), r0 /* r0 |= LCD_SD */
and #(~(LCD_CS|LCD_DS|LCD_SC)), r0 /* r0 &= ~(LCD_CS|LCD_DS|LCD_SC) */

View file

@ -82,7 +82,7 @@
_lcd_write_command:
mov.l .lcdr, r3 /* put lcd data port address in r3 */
mov r4, r1 /* copy data byte to r1 */
mov #1, r5 /* set byte count to 1 (!) */
mov #0, r5 /* fake end address - stop after first iteration */
/* This code will fail if an interrupt changes the contents of PBDRL.
* If so, we must disable the interrupt here. */
@ -110,7 +110,7 @@ _lcd_write_command:
* r1 - command/data byte (copied)
* r2 - precalculated port value (CS, DS and SC low, SD high)
* r3 - lcd port address
* r5 - 1 (byte count for reuse of the loop in _lcd_write_data)
* r5 - fake end address
* r6 - data byte (saved)
* r7 - saved pr
*/
@ -119,7 +119,7 @@ _lcd_write_command_e:
mov.l .lcdr, r3 /* put lcd data port address in r3 */
mov r4, r1 /* copy data byte to r1 */
mov r5, r6
mov #1, r5 /* set byte count to 1 (!) */
mov #0, r5 /* fake end address - stop after first iteration */
/* This code will fail if an interrupt changes the contents of PBDRL.
* If so, we must disable the interrupt here. */
@ -134,7 +134,6 @@ _lcd_write_command_e:
lds r7, pr
mov r6, r1
mov #1, r5 /* set byte count to 1 (!) */
or #(LCD_DS|LCD_SD), r0 /* r0 |= LCD_DS|LCD_SD */
and #(~(LCD_CS|LCD_SC)), r0 /* r0 &= ~(LCD_CS|LCD_SC) */
bra .single_transfer /* jump into the transfer loop */
@ -156,14 +155,15 @@ _lcd_write_command_e:
* Register usage:
* r0 - scratch
* r1 - current data byte
* r2 - precalculated port value (CS and SC low, DS and SD high),
* negated (neg)!
* r2 - precalculated port value (CS and SC low, DS and SD high)
* r3 - lcd port address
* r4 - current address
* r5 - end address
*/
_lcd_write_data:
mov.l .lcdr, r3 /* put lcd data port address in r3 */
nop /* align here */
add r4, r5 /* end address */
/* This code will fail if an interrupt changes the contents of PBDRL.
* If so, we must disable the interrupt here. If disabling interrupts
@ -257,9 +257,8 @@ _lcd_write_data:
or #(LCD_SC), r0
mov.b r0, @r3
add #-1, r5 /* decrease byte count */
tst r5, r5 /* r5 == 0 ? */
bf .multi_transfer /* no: next iteration */
cmp/hi r4, r5 /* some blocks left? */
bt .multi_transfer
or #(LCD_CS|LCD_DS|LCD_SD|LCD_SC),r0 /* restore port */
rts
@ -271,6 +270,3 @@ _lcd_write_data:
.align 2
.lcdr:
.long LCDR
.end:
.size _lcd_write_command,.end-_lcd_write_command