summaryrefslogtreecommitdiff
path: root/firmware/target/arm/ipod
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2009-07-11 23:43:44 +0000
committerJens Arnold <amiconn@rockbox.org>2009-07-11 23:43:44 +0000
commit47d4c4739bafcb9864dc8d1c2b44903ad4f75b68 (patch)
tree7a9f510c72a0df2ddacb0f6ec393658cf676b8d4 /firmware/target/arm/ipod
parentfa59ed6ae724b3f75c8ba35efcf7ce18f21e3ed2 (diff)
downloadrockbox-47d4c4739bafcb9864dc8d1c2b44903ad4f75b68.tar.gz
rockbox-47d4c4739bafcb9864dc8d1c2b44903ad4f75b68.zip
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.S71
-rw-r--r--firmware/target/arm/ipod/video/lcd-as-video.S26
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 @@
34 .type lcd_write_data,%function 34 .type lcd_write_data,%function
35 35
36lcd_write_data: 36lcd_write_data:
37 str lr, [sp, #-4]! 37 ldr r12, =LCD1_BASE
38 ldr lr, =LCD1_BASE
39 38
40.loop: 39.loop:
41 ldrb r2, [r0], #1 40 ldrb r2, [r0], #1
@@ -45,29 +44,29 @@ lcd_write_data:
45 orr r2, r3, r2, lsl #8 44 orr r2, r3, r2, lsl #8
46 orr r2, r2, #0x760000 45 orr r2, r2, #0x760000
471: 461:
48 ldr r3, [lr] 47 ldr r3, [r12]
49 tst r3, #LCD1_BUSY_MASK 48 tst r3, #LCD1_BUSY_MASK
50 bne 1b 49 bne 1b
51 str r2, [lr, #0x08] 50 str r2, [r12, #0x08]
52#else 51#else
531: 521:
54 ldr r3, [lr] 53 ldr r3, [r12]
55 tst r3, #LCD1_BUSY_MASK 54 tst r3, #LCD1_BUSY_MASK
56 bne 1b 55 bne 1b
57 str r2, [lr, #0x10] 56 str r2, [r12, #0x10]
58 57
59 ldrb r2, [r0], #1 58 ldrb r2, [r0], #1
601: 591:
61 ldr r3, [lr] 60 ldr r3, [r12]
62 tst r3, #LCD1_BUSY_MASK 61 tst r3, #LCD1_BUSY_MASK
63 bne 1b 62 bne 1b
64 str r2, [lr, #0x10] 63 str r2, [r12, #0x10]
65#endif 64#endif
66 65
67 subs r1, r1, #1 66 subs r1, r1, #1
68 bne .loop 67 bne .loop
69 68
70 ldr pc, [sp], #4 69 bx lr
71 .size lcd_write_data,.-lcd_write_data 70 .size lcd_write_data,.-lcd_write_data
72 71
73 72
@@ -77,9 +76,9 @@ lcd_write_data:
77 .type lcd_write_data_shifted,%function 76 .type lcd_write_data_shifted,%function
78 77
79lcd_write_data_shifted: 78lcd_write_data_shifted:
80 stmfd sp!, {r4, r5, lr} 79 stmfd sp!, {r4, lr}
81 ldr lr, =LCD1_BASE 80 ldr lr, =LCD1_BASE
82 mov r5, #0x760000 81 mov r12, #0x760000
83 ldrb r2, [r0], #1 82 ldrb r2, [r0], #1
84 83
85.sloop: 84.sloop:
@@ -88,7 +87,7 @@ lcd_write_data_shifted:
88 ldrb r3, [r0], #1 87 ldrb r3, [r0], #1
89 orr r2, r3, r2, lsl #8 88 orr r2, r3, r2, lsl #8
90 mov r4, r2, lsl #12 89 mov r4, r2, lsl #12
91 orr r4, r5, r4, lsr #16 90 orr r4, r12, r4, lsr #16
921: 911:
93 ldr r3, [lr] 92 ldr r3, [lr]
94 tst r3, #LCD1_BUSY_MASK 93 tst r3, #LCD1_BUSY_MASK
@@ -98,7 +97,7 @@ lcd_write_data_shifted:
98 subs r1, r1, #1 97 subs r1, r1, #1
99 bne .sloop 98 bne .sloop
100 99
101 ldmfd sp!, {r4, r5, pc} 100 ldmfd sp!, {r4, pc}
102 .size lcd_write_data_shifted,.-lcd_write_data_shifted 101 .size lcd_write_data_shifted,.-lcd_write_data_shifted
103 102
104#elif defined IPOD_MINI 103#elif defined IPOD_MINI
@@ -107,33 +106,33 @@ lcd_write_data_shifted:
107 .type lcd_write_data_shifted,%function 106 .type lcd_write_data_shifted,%function
108 107
109lcd_write_data_shifted: 108lcd_write_data_shifted:
110 stmfd sp!, {r4, lr} 109 str lr, [sp, #-4]!
111 ldr lr, =LCD1_BASE 110 ldr lr, =LCD1_BASE
112 ldrb r2, [r0], #1 111 ldrb r2, [r0], #1
113 112
114.sloop: 113.sloop:
115 ldrb r3, [r0], #1 114 ldrb r3, [r0], #1
116 orr r2, r3, r2, lsl #8 115 orr r2, r3, r2, lsl #8
117 mov r4, r2, lsr #4 116 mov r12, r2, lsr #4
1181: 1171:
119 ldr r3, [lr] 118 ldr r3, [lr]
120 tst r3, #LCD1_BUSY_MASK 119 tst r3, #LCD1_BUSY_MASK
121 bne 1b 120 bne 1b
122 str r4, [lr, #0x10] 121 str r12, [lr, #0x10]
123 122
124 ldrb r3, [r0], #1 123 ldrb r3, [r0], #1
125 orr r2, r3, r2, lsl #8 124 orr r2, r3, r2, lsl #8
126 mov r4, r2, lsr #4 125 mov r12, r2, lsr #4
1271: 1261:
128 ldr r3, [lr] 127 ldr r3, [lr]
129 tst r3, #LCD1_BUSY_MASK 128 tst r3, #LCD1_BUSY_MASK
130 bne 1b 129 bne 1b
131 str r4, [lr, #0x10] 130 str r12, [lr, #0x10]
132 131
133 subs r1, r1, #1 132 subs r1, r1, #1
134 bne .sloop 133 bne .sloop
135 134
136 ldmfd sp!, {r4, pc} 135 ldr pc, [sp], #4
137 .size lcd_write_data_shifted,.-lcd_write_data_shifted 136 .size lcd_write_data_shifted,.-lcd_write_data_shifted
138 137
139#endif 138#endif
@@ -142,18 +141,18 @@ lcd_write_data_shifted:
142 .type lcd_mono_data,%function 141 .type lcd_mono_data,%function
143 142
144lcd_mono_data: 143lcd_mono_data:
145 stmfd sp!, {r4, r5, lr} 144 stmfd sp!, {r4, lr}
146 ldr lr, =LCD1_BASE 145 ldr lr, =LCD1_BASE
147 adr r5, .dibits 146 adr r12, .dibits
148 147
149.mloop: 148.mloop:
150 ldrb r2, [r0], #1 149 ldrb r2, [r0], #1
151 mov r3, r2, lsr #4 150 mov r3, r2, lsr #4
152 ldrb r4, [r5, r3] 151 ldrb r4, [r12, r3]
153 152
154#ifdef IPOD_MINI2G 153#ifdef IPOD_MINI2G
155 and r3, r2, #0x0f 154 and r3, r2, #0x0f
156 ldrb r3, [r5, r3] 155 ldrb r3, [r12, r3]
157 orr r4, r3, r4, lsl #8 156 orr r4, r3, r4, lsl #8
158 orr r4, r4, #0x760000 157 orr r4, r4, #0x760000
1591: 1581:
@@ -169,7 +168,7 @@ lcd_mono_data:
169 str r4, [lr, #0x10] 168 str r4, [lr, #0x10]
170 169
171 and r3, r2, #0x0f 170 and r3, r2, #0x0f
172 ldrb r4, [r5, r3] 171 ldrb r4, [r12, r3]
1731: 1721:
174 ldr r3, [lr] 173 ldr r3, [lr]
175 tst r3, #LCD1_BUSY_MASK 174 tst r3, #LCD1_BUSY_MASK
@@ -180,7 +179,7 @@ lcd_mono_data:
180 subs r1, r1, #1 179 subs r1, r1, #1
181 bne .mloop 180 bne .mloop
182 181
183 ldmfd sp!, {r4, r5, pc} 182 ldmfd sp!, {r4, pc}
184 183
185.dibits: 184.dibits:
186 .byte 0x00, 0x03, 0x0C, 0x0F, 0x30, 0x33, 0x3C, 0x3F 185 .byte 0x00, 0x03, 0x0C, 0x0F, 0x30, 0x33, 0x3C, 0x3F
@@ -203,16 +202,16 @@ lcd_mono_data:
203 * Register usage: 202 * Register usage:
204 * r3/r4 - current block of phases 203 * r3/r4 - current block of phases
205 * r5/r6 - current block of values 204 * r5/r6 - current block of values
206 * r7 - lcd data accumulator 205 * r7 - lcd data accumulator
207 * r8 - phase signs mask 206 * r12 - phase signs mask
208 * lr - lcd bridge address 207 * lr - lcd bridge address
209 */ 208 */
210 209
211lcd_grey_data: 210lcd_grey_data:
212 stmfd sp!, {r4-r8, lr} 211 stmfd sp!, {r4-r7, lr}
213 mov r8, #0x80 212 mov r12, #0x80
214 orr r8, r8, r8, lsl #8 213 orr r12, r12, r12, lsl #8
215 orr r8, r8, r8, lsl #16 214 orr r12, r12, r12, lsl #16
216 ldr lr, =LCD1_BASE 215 ldr lr, =LCD1_BASE
217 216
218.greyloop: 217.greyloop:
@@ -229,7 +228,7 @@ lcd_grey_data:
229 orreq r7, r7, #0x0c00 228 orreq r7, r7, #0x0c00
230 tst r3, #0x80000000 229 tst r3, #0x80000000
231 orreq r7, r7, #0x0300 230 orreq r7, r7, #0x0300
232 bic r3, r3, r8 231 bic r3, r3, r12
233 add r3, r3, r5 232 add r3, r3, r5
234#else /* Parallel bridge mode */ 233#else /* Parallel bridge mode */
235 mov r7, #0 234 mov r7, #0
@@ -241,7 +240,7 @@ lcd_grey_data:
241 orreq r7, r7, #0x0c 240 orreq r7, r7, #0x0c
242 tst r3, #0x80000000 241 tst r3, #0x80000000
243 orreq r7, r7, #0x03 242 orreq r7, r7, #0x03
244 bic r3, r3, r8 243 bic r3, r3, r12
245 add r3, r3, r5 244 add r3, r3, r5
246 245
2471: 2461:
@@ -261,7 +260,7 @@ lcd_grey_data:
261 orreq r7, r7, #0x0c 260 orreq r7, r7, #0x0c
262 tst r4, #0x80000000 261 tst r4, #0x80000000
263 orreq r7, r7, #0x03 262 orreq r7, r7, #0x03
264 bic r4, r4, r8 263 bic r4, r4, r12
265 add r4, r4, r6 264 add r4, r4, r6
266 265
267 stmia r1!, {r3-r4} 266 stmia r1!, {r3-r4}
@@ -279,6 +278,6 @@ lcd_grey_data:
279 subs r2, r2, #1 278 subs r2, r2, #1
280 bne .greyloop 279 bne .greyloop
281 280
282 ldmfd sp!, {r4-r8, pc} 281 ldmfd sp!, {r4-r7, pc}
283 .size lcd_grey_data,.-lcd_grey_data 282 .size lcd_grey_data,.-lcd_grey_data
284 283
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 @@
32 .type lcd_write_data, %function 32 .type lcd_write_data, %function
33 /* r0 = addr, must be aligned */ 33 /* r0 = addr, must be aligned */
34lcd_write_data: /* r1 = pixel count, must be even */ 34lcd_write_data: /* r1 = pixel count, must be even */
35 stmfd sp!, {r4-r5, lr} 35 stmfd sp!, {r4, lr}
36 mov lr, #0x30000000 /* LCD data port */ 36 mov lr, #0x30000000 /* LCD data port */
37 37
38 subs r1, r1, #16 38 subs r1, r1, #16
39.loop16: 39.loop16:
40 ldmgeia r0!, {r2-r5} 40 ldmgeia r0!, {r2-r4, r12}
41 stmgeia lr, {r2-r5} 41 stmgeia lr, {r2-r4, r12}
42 ldmgeia r0!, {r2-r5} 42 ldmgeia r0!, {r2-r4, r12}
43 stmgeia lr, {r2-r5} 43 stmgeia lr, {r2-r4, r12}
44 subges r1, r1, #16 44 subges r1, r1, #16
45 bge .loop16 45 bge .loop16
46 46
47 /* no need to correct the count, we're just checking bits from now */ 47 /* no need to correct the count, we're just checking bits from now */
48 tst r1, #8 48 tst r1, #8
49 ldmneia r0!, {r2-r5} 49 ldmneia r0!, {r2-r4, r12}
50 stmneia lr, {r2-r5} 50 stmneia lr, {r2-r4, r12}
51 tst r1, #4 51 tst r1, #4
52 ldmneia r0!, {r2-r3} 52 ldmneia r0!, {r2-r3}
53 stmneia lr, {r2-r3} 53 stmneia lr, {r2-r3}
@@ -55,7 +55,7 @@ lcd_write_data: /* r1 = pixel count, must be even */
55 ldrne r3, [r0], #4 55 ldrne r3, [r0], #4
56 strne r3, [lr] 56 strne r3, [lr]
57 57
58 ldmfd sp!, {r4-r5, pc} 58 ldmfd sp!, {r4, pc}
59 59
60/**************************************************************************** 60/****************************************************************************
61 * extern void lcd_write_yuv420_lines(unsigned char const * const src[3], 61 * extern void lcd_write_yuv420_lines(unsigned char const * const src[3],
@@ -87,10 +87,10 @@ lcd_write_yuv420_lines:
87 /* r1 = dst = bcmaddr */ 87 /* r1 = dst = bcmaddr */
88 /* r2 = width */ 88 /* r2 = width */
89 /* r3 = stride */ 89 /* r3 = stride */
90 stmfd sp!, { r4-r11, lr } /* save non-scratch */ 90 stmfd sp!, { r4-r10, lr } /* save non-scratch */
91 ldmia r0, { r9-r11 } /* r9 = yuv_src[0] = Y'_p */ 91 ldmia r0, { r9, r10, r12 } /* r9 = yuv_src[0] = Y'_p */
92 /* r10 = yuv_src[1] = Cb_p */ 92 /* r10 = yuv_src[1] = Cb_p */
93 /* r11 = yuv_src[2] = Cr_p */ 93 /* r12 = yuv_src[2] = Cr_p */
94 add r3, r9, r3 /* r3 = &ysrc[stride] */ 94 add r3, r9, r3 /* r3 = &ysrc[stride] */
95 add r4, r2, r2, asr #1 /* chroma buffer lenght = width/2 *3 */ 95 add r4, r2, r2, asr #1 /* chroma buffer lenght = width/2 *3 */
96 mov r4, r4, asl #2 /* use words for str/ldm possibility */ 96 mov r4, r4, asl #2 /* use words for str/ldm possibility */
@@ -116,7 +116,7 @@ lcd_write_yuv420_lines:
11610: /* loop start */ 11610: /* loop start */
117 117
118 ldrb r0, [r10], #1 /* r0 = *usrc++ = *Cb_p++ */ 118 ldrb r0, [r10], #1 /* r0 = *usrc++ = *Cb_p++ */
119 ldrb r1, [r11], #1 /* r1 = *vsrc++ = *Cr_p++ */ 119 ldrb r1, [r12], #1 /* r1 = *vsrc++ = *Cr_p++ */
120 120
121 sub r0, r0, #128 /* r0 = Cb-128 */ 121 sub r0, r0, #128 /* r0 = Cb-128 */
122 sub r1, r1, #128 /* r1 = Cr-128 */ 122 sub r1, r1, #128 /* r1 = Cr-128 */
@@ -289,7 +289,7 @@ lcd_write_yuv420_lines:
289 289
290 ldr r3, [sp, #12] 290 ldr r3, [sp, #12]
291 add sp, sp, r3 /* deallocate buffer */ 291 add sp, sp, r3 /* deallocate buffer */
292 ldmfd sp!, { r4-r11, pc } /* restore registers */ 292 ldmfd sp!, { r4-r10, pc } /* restore registers */
293 293
294 .ltorg 294 .ltorg
295 .size lcd_write_yuv420_lines, .-lcd_write_yuv420_lines 295 .size lcd_write_yuv420_lines, .-lcd_write_yuv420_lines