diff options
author | Jens Arnold <amiconn@rockbox.org> | 2009-07-11 23:43:44 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2009-07-11 23:43:44 +0000 |
commit | 47d4c4739bafcb9864dc8d1c2b44903ad4f75b68 (patch) | |
tree | 7a9f510c72a0df2ddacb0f6ec393658cf676b8d4 /firmware/target/arm/ipod | |
parent | fa59ed6ae724b3f75c8ba35efcf7ce18f21e3ed2 (diff) |
ARM asm LCD and ATA driver functions: Don't save r12 as it is a scratch reg. Saves a bit of stack and execution time.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21795 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/ipod')
-rw-r--r-- | firmware/target/arm/ipod/lcd-as-gray.S | 71 | ||||
-rw-r--r-- | firmware/target/arm/ipod/video/lcd-as-video.S | 26 |
2 files changed, 48 insertions, 49 deletions
diff --git a/firmware/target/arm/ipod/lcd-as-gray.S b/firmware/target/arm/ipod/lcd-as-gray.S index a066e55a05..b6878a1a78 100644 --- a/firmware/target/arm/ipod/lcd-as-gray.S +++ b/firmware/target/arm/ipod/lcd-as-gray.S @@ -34,8 +34,7 @@ .type lcd_write_data,%function lcd_write_data: - str lr, [sp, #-4]! - ldr lr, =LCD1_BASE + ldr r12, =LCD1_BASE .loop: ldrb r2, [r0], #1 @@ -45,29 +44,29 @@ lcd_write_data: orr r2, r3, r2, lsl #8 orr r2, r2, #0x760000 1: - ldr r3, [lr] + ldr r3, [r12] tst r3, #LCD1_BUSY_MASK bne 1b - str r2, [lr, #0x08] + str r2, [r12, #0x08] #else 1: - ldr r3, [lr] + ldr r3, [r12] tst r3, #LCD1_BUSY_MASK bne 1b - str r2, [lr, #0x10] + str r2, [r12, #0x10] ldrb r2, [r0], #1 1: - ldr r3, [lr] + ldr r3, [r12] tst r3, #LCD1_BUSY_MASK bne 1b - str r2, [lr, #0x10] + str r2, [r12, #0x10] #endif subs r1, r1, #1 bne .loop - ldr pc, [sp], #4 + bx lr .size lcd_write_data,.-lcd_write_data @@ -77,9 +76,9 @@ lcd_write_data: .type lcd_write_data_shifted,%function lcd_write_data_shifted: - stmfd sp!, {r4, r5, lr} + stmfd sp!, {r4, lr} ldr lr, =LCD1_BASE - mov r5, #0x760000 + mov r12, #0x760000 ldrb r2, [r0], #1 .sloop: @@ -88,7 +87,7 @@ lcd_write_data_shifted: ldrb r3, [r0], #1 orr r2, r3, r2, lsl #8 mov r4, r2, lsl #12 - orr r4, r5, r4, lsr #16 + orr r4, r12, r4, lsr #16 1: ldr r3, [lr] tst r3, #LCD1_BUSY_MASK @@ -98,7 +97,7 @@ lcd_write_data_shifted: subs r1, r1, #1 bne .sloop - ldmfd sp!, {r4, r5, pc} + ldmfd sp!, {r4, pc} .size lcd_write_data_shifted,.-lcd_write_data_shifted #elif defined IPOD_MINI @@ -107,33 +106,33 @@ lcd_write_data_shifted: .type lcd_write_data_shifted,%function lcd_write_data_shifted: - stmfd sp!, {r4, lr} + str lr, [sp, #-4]! ldr lr, =LCD1_BASE ldrb r2, [r0], #1 .sloop: ldrb r3, [r0], #1 orr r2, r3, r2, lsl #8 - mov r4, r2, lsr #4 + mov r12, r2, lsr #4 1: ldr r3, [lr] tst r3, #LCD1_BUSY_MASK bne 1b - str r4, [lr, #0x10] + str r12, [lr, #0x10] ldrb r3, [r0], #1 orr r2, r3, r2, lsl #8 - mov r4, r2, lsr #4 + mov r12, r2, lsr #4 1: ldr r3, [lr] tst r3, #LCD1_BUSY_MASK bne 1b - str r4, [lr, #0x10] + str r12, [lr, #0x10] subs r1, r1, #1 bne .sloop - ldmfd sp!, {r4, pc} + ldr pc, [sp], #4 .size lcd_write_data_shifted,.-lcd_write_data_shifted #endif @@ -142,18 +141,18 @@ lcd_write_data_shifted: .type lcd_mono_data,%function lcd_mono_data: - stmfd sp!, {r4, r5, lr} + stmfd sp!, {r4, lr} ldr lr, =LCD1_BASE - adr r5, .dibits + adr r12, .dibits .mloop: ldrb r2, [r0], #1 mov r3, r2, lsr #4 - ldrb r4, [r5, r3] + ldrb r4, [r12, r3] #ifdef IPOD_MINI2G and r3, r2, #0x0f - ldrb r3, [r5, r3] + ldrb r3, [r12, r3] orr r4, r3, r4, lsl #8 orr r4, r4, #0x760000 1: @@ -169,7 +168,7 @@ lcd_mono_data: str r4, [lr, #0x10] and r3, r2, #0x0f - ldrb r4, [r5, r3] + ldrb r4, [r12, r3] 1: ldr r3, [lr] tst r3, #LCD1_BUSY_MASK @@ -180,7 +179,7 @@ lcd_mono_data: subs r1, r1, #1 bne .mloop - ldmfd sp!, {r4, r5, pc} + ldmfd sp!, {r4, pc} .dibits: .byte 0x00, 0x03, 0x0C, 0x0F, 0x30, 0x33, 0x3C, 0x3F @@ -203,16 +202,16 @@ lcd_mono_data: * Register usage: * r3/r4 - current block of phases * r5/r6 - current block of values - * r7 - lcd data accumulator - * r8 - phase signs mask - * lr - lcd bridge address + * r7 - lcd data accumulator + * r12 - phase signs mask + * lr - lcd bridge address */ lcd_grey_data: - stmfd sp!, {r4-r8, lr} - mov r8, #0x80 - orr r8, r8, r8, lsl #8 - orr r8, r8, r8, lsl #16 + stmfd sp!, {r4-r7, lr} + mov r12, #0x80 + orr r12, r12, r12, lsl #8 + orr r12, r12, r12, lsl #16 ldr lr, =LCD1_BASE .greyloop: @@ -229,7 +228,7 @@ lcd_grey_data: orreq r7, r7, #0x0c00 tst r3, #0x80000000 orreq r7, r7, #0x0300 - bic r3, r3, r8 + bic r3, r3, r12 add r3, r3, r5 #else /* Parallel bridge mode */ mov r7, #0 @@ -241,7 +240,7 @@ lcd_grey_data: orreq r7, r7, #0x0c tst r3, #0x80000000 orreq r7, r7, #0x03 - bic r3, r3, r8 + bic r3, r3, r12 add r3, r3, r5 1: @@ -261,7 +260,7 @@ lcd_grey_data: orreq r7, r7, #0x0c tst r4, #0x80000000 orreq r7, r7, #0x03 - bic r4, r4, r8 + bic r4, r4, r12 add r4, r4, r6 stmia r1!, {r3-r4} @@ -279,6 +278,6 @@ lcd_grey_data: subs r2, r2, #1 bne .greyloop - ldmfd sp!, {r4-r8, pc} + ldmfd sp!, {r4-r7, pc} .size lcd_grey_data,.-lcd_grey_data diff --git a/firmware/target/arm/ipod/video/lcd-as-video.S b/firmware/target/arm/ipod/video/lcd-as-video.S index e14b9dafb8..4b0cabcec2 100644 --- a/firmware/target/arm/ipod/video/lcd-as-video.S +++ b/firmware/target/arm/ipod/video/lcd-as-video.S @@ -32,22 +32,22 @@ .type lcd_write_data, %function /* r0 = addr, must be aligned */ lcd_write_data: /* r1 = pixel count, must be even */ - stmfd sp!, {r4-r5, lr} + stmfd sp!, {r4, lr} mov lr, #0x30000000 /* LCD data port */ subs r1, r1, #16 .loop16: - ldmgeia r0!, {r2-r5} - stmgeia lr, {r2-r5} - ldmgeia r0!, {r2-r5} - stmgeia lr, {r2-r5} + ldmgeia r0!, {r2-r4, r12} + stmgeia lr, {r2-r4, r12} + ldmgeia r0!, {r2-r4, r12} + stmgeia lr, {r2-r4, r12} subges r1, r1, #16 bge .loop16 /* no need to correct the count, we're just checking bits from now */ tst r1, #8 - ldmneia r0!, {r2-r5} - stmneia lr, {r2-r5} + ldmneia r0!, {r2-r4, r12} + stmneia lr, {r2-r4, r12} tst r1, #4 ldmneia r0!, {r2-r3} stmneia lr, {r2-r3} @@ -55,7 +55,7 @@ lcd_write_data: /* r1 = pixel count, must be even */ ldrne r3, [r0], #4 strne r3, [lr] - ldmfd sp!, {r4-r5, pc} + ldmfd sp!, {r4, pc} /**************************************************************************** * extern void lcd_write_yuv420_lines(unsigned char const * const src[3], @@ -87,10 +87,10 @@ lcd_write_yuv420_lines: /* r1 = dst = bcmaddr */ /* r2 = width */ /* r3 = stride */ - stmfd sp!, { r4-r11, lr } /* save non-scratch */ - ldmia r0, { r9-r11 } /* r9 = yuv_src[0] = Y'_p */ + stmfd sp!, { r4-r10, lr } /* save non-scratch */ + ldmia r0, { r9, r10, r12 } /* r9 = yuv_src[0] = Y'_p */ /* r10 = yuv_src[1] = Cb_p */ - /* r11 = yuv_src[2] = Cr_p */ + /* r12 = yuv_src[2] = Cr_p */ add r3, r9, r3 /* r3 = &ysrc[stride] */ add r4, r2, r2, asr #1 /* chroma buffer lenght = width/2 *3 */ mov r4, r4, asl #2 /* use words for str/ldm possibility */ @@ -116,7 +116,7 @@ lcd_write_yuv420_lines: 10: /* loop start */ ldrb r0, [r10], #1 /* r0 = *usrc++ = *Cb_p++ */ - ldrb r1, [r11], #1 /* r1 = *vsrc++ = *Cr_p++ */ + ldrb r1, [r12], #1 /* r1 = *vsrc++ = *Cr_p++ */ sub r0, r0, #128 /* r0 = Cb-128 */ sub r1, r1, #128 /* r1 = Cr-128 */ @@ -289,7 +289,7 @@ lcd_write_yuv420_lines: ldr r3, [sp, #12] add sp, sp, r3 /* deallocate buffer */ - ldmfd sp!, { r4-r11, pc } /* restore registers */ + ldmfd sp!, { r4-r10, pc } /* restore registers */ .ltorg .size lcd_write_yuv420_lines, .-lcd_write_yuv420_lines |