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/lcd-as-gray.S | |
parent | fa59ed6ae724b3f75c8ba35efcf7ce18f21e3ed2 (diff) | |
download | rockbox-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/lcd-as-gray.S')
-rw-r--r-- | firmware/target/arm/ipod/lcd-as-gray.S | 71 |
1 files changed, 35 insertions, 36 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 | ||
36 | lcd_write_data: | 36 | lcd_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 |
47 | 1: | 46 | 1: |
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 |
53 | 1: | 52 | 1: |
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 |
60 | 1: | 59 | 1: |
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 | ||
79 | lcd_write_data_shifted: | 78 | lcd_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 |
92 | 1: | 91 | 1: |
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 | ||
109 | lcd_write_data_shifted: | 108 | lcd_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 |
118 | 1: | 117 | 1: |
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 |
127 | 1: | 126 | 1: |
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 | ||
144 | lcd_mono_data: | 143 | lcd_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 |
159 | 1: | 158 | 1: |
@@ -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] |
173 | 1: | 172 | 1: |
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 | ||
211 | lcd_grey_data: | 210 | lcd_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 | ||
247 | 1: | 246 | 1: |
@@ -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 | ||