diff options
author | Thom Johansen <thomj@rockbox.org> | 2007-02-27 17:33:23 +0000 |
---|---|---|
committer | Thom Johansen <thomj@rockbox.org> | 2007-02-27 17:33:23 +0000 |
commit | 9636c1b61eb93897bffd4db96ddc9678c6aff245 (patch) | |
tree | f718bfba9c86418d415eb71b1a2ad0891210aca4 /apps/dsp_arm.S | |
parent | 342337031cc7c20c141fb11a0d7aa900e89e022e (diff) | |
download | rockbox-9636c1b61eb93897bffd4db96ddc9678c6aff245.tar.gz rockbox-9636c1b61eb93897bffd4db96ddc9678c6aff245.zip |
Adapt ARM crossfeed assembler to work like the Coldfire one. Remove SWITCHPARAM cruft as it's no longer needed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12507 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/dsp_arm.S')
-rw-r--r-- | apps/dsp_arm.S | 91 |
1 files changed, 46 insertions, 45 deletions
diff --git a/apps/dsp_arm.S b/apps/dsp_arm.S index 1abfd34983..27669203f1 100644 --- a/apps/dsp_arm.S +++ b/apps/dsp_arm.S | |||
@@ -7,7 +7,7 @@ | |||
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2006 Thom Johansen | 10 | * Copyright (C) 2006-2007 Thom Johansen |
11 | * | 11 | * |
12 | * All files in this archive are subject to the GNU General Public License. | 12 | * All files in this archive are subject to the GNU General Public License. |
13 | * See the file COPYING in the source tree root for full license agreement. | 13 | * See the file COPYING in the source tree root for full license agreement. |
@@ -17,63 +17,64 @@ | |||
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | /* | ||
21 | * void apply_crossfeed(int count, int32_t* src[]) | ||
22 | */ | ||
20 | .section .text | 23 | .section .text |
21 | .global apply_crossfeed | 24 | .global apply_crossfeed |
22 | apply_crossfeed: | 25 | apply_crossfeed: |
23 | @ unfortunately, we ended up in a bit of a register squeeze here, and need | 26 | @ unfortunately, we ended up in a bit of a register squeeze here, and need |
24 | @ to keep both the count and the delay line index on the stack :/ | 27 | @ to keep both the count and the delay line index on the stack :/ |
25 | stmdb sp!, { r4-r11, lr } @ stack modified regs | 28 | stmdb sp!, { r4-r11, lr } @ stack modified regs |
26 | ldmia r0, { r2-r3 } @ r2 = src[0], r3 = src[1] | 29 | ldmia r1, { r2-r3 } @ r2 = src[0], r3 = src[1] |
27 | 30 | ||
28 | ldr r0, =crossfeed_data | 31 | ldr r1, =crossfeed_data |
29 | ldmia r0!, { r4-r11 } @ load direct gain and filter data | 32 | ldmia r1!, { r4-r11 } @ load direct gain and filter data |
30 | ldr r12, [r0, #13*4*2] @ fetch delay line index | 33 | add r12, r1, #13*4*2 @ calculate end of delay |
31 | add r0, r0, r12, lsl #3 @ r0 = &delay[index][0] | 34 | stmdb sp!, { r0, r12 } @ stack count and end of delay adr |
32 | stmdb sp!, { r1, r12 } @ stack count and delay line index | 35 | ldr r0, [r1, #13*4*2] @ fetch current delay line address |
36 | |||
33 | /* Register usage in loop: | 37 | /* Register usage in loop: |
34 | * r0 = &delay[index][0], r1 = accumulator high, r2 = src[0], r3 = src[1], | 38 | * r0 = &delay[index][0], r1 = accumulator high, r2 = src[0], r3 = src[1], |
35 | * r4 = direct gain, r5-r7 = b0, b1, a1 (filter coefs), | 39 | * r4 = direct gain, r5-r7 = b0, b1, a1 (filter coefs), |
36 | * r8-r11 = filter history, r12 = temp, r14 = accumulator low | 40 | * r8-r11 = filter history, r12 = temp, r14 = accumulator low |
37 | */ | 41 | */ |
38 | .cfloop: | 42 | .cfloop: |
39 | smull r14, r1, r6, r8 @ acc = b1*dr[n - 1] | 43 | smull r14, r1, r6, r8 @ acc = b1*dr[n - 1] |
40 | smlal r14, r1, r7, r9 @ acc += a1*y_l[n - 1] | 44 | smlal r14, r1, r7, r9 @ acc += a1*y_l[n - 1] |
41 | ldr r8, [r0, #4] @ r8 = dr[n] | 45 | ldr r8, [r0, #4] @ r8 = dr[n] |
42 | smlal r14, r1, r5, r8 @ acc += b0*dr[n] | 46 | smlal r14, r1, r5, r8 @ acc += b0*dr[n] |
43 | mov r9, r1, lsl #1 @ fix format for filter history | 47 | mov r9, r1, lsl #1 @ fix format for filter history |
44 | ldr r12, [r2] @ load left input | 48 | ldr r12, [r2] @ load left input |
45 | smlal r14, r1, r4, r12 @ acc += gain*x_l[n] | 49 | smlal r14, r1, r4, r12 @ acc += gain*x_l[n] |
46 | mov r1, r1, lsl #1 @ fix format | 50 | mov r1, r1, lsl #1 @ fix format |
47 | str r1, [r2], #4 @ save result | 51 | str r1, [r2], #4 @ save result |
48 | |||
49 | smull r14, r1, r6, r10 @ acc = b1*dl[n - 1] | ||
50 | smlal r14, r1, r7, r11 @ acc += a1*y_r[n - 1] | ||
51 | ldr r10, [r0] @ r10 = dl[n] | ||
52 | str r12, [r0], #4 @ save left input to delay line | ||
53 | smlal r14, r1, r5, r10 @ acc += b0*dl[n] | ||
54 | mov r11, r1, lsl #1 @ fix format for filter history | ||
55 | ldr r12, [r3] @ load right input | ||
56 | smlal r14, r1, r4, r12 @ acc += gain*x_r[n] | ||
57 | str r12, [r0], #4 @ save right input to delay line | ||
58 | mov r1, r1, lsl #1 @ fix format | ||
59 | str r1, [r3], #4 @ save result | ||
60 | 52 | ||
61 | ldr r12, [sp, #4] @ fetch delay line index from stack | 53 | smull r14, r1, r6, r10 @ acc = b1*dl[n - 1] |
62 | add r12, r12, #1 @ increment index | 54 | smlal r14, r1, r7, r11 @ acc += a1*y_r[n - 1] |
63 | cmp r12, #13 @ do we need to wrap to start of delay? | 55 | ldr r10, [r0] @ r10 = dl[n] |
64 | moveq r12, #0 @ yes, wrap index to 0 | 56 | str r12, [r0], #4 @ save left input to delay line |
65 | subeq r0, r0, #13*4*2 @ also wrap back delay line ptr to start | 57 | smlal r14, r1, r5, r10 @ acc += b0*dl[n] |
66 | str r12, [sp, #4] @ stack delay line index again | 58 | mov r11, r1, lsl #1 @ fix format for filter history |
67 | 59 | ldr r12, [r3] @ load right input | |
68 | ldr r1, [sp] @ fetch count from stack | 60 | smlal r14, r1, r4, r12 @ acc += gain*x_r[n] |
69 | subs r1, r1, #1 @ are we finished? | 61 | str r12, [r0], #4 @ save right input to delay line |
70 | strne r1, [sp] @ nope, save count back to stack | 62 | mov r1, r1, lsl #1 @ fix format |
71 | bne .cfloop | 63 | str r1, [r3], #4 @ save result |
64 | |||
65 | ldr r12, [sp, #4] @ fetch delay line end addr from stack | ||
66 | cmp r0, r12 @ need to wrap to start of delay? | ||
67 | subeq r0, r0, #13*4*2 @ wrap back delay line ptr to start | ||
68 | |||
69 | ldr r1, [sp] @ fetch count from stack | ||
70 | subs r1, r1, #1 @ are we finished? | ||
71 | strne r1, [sp] @ nope, save count back to stack | ||
72 | bne .cfloop | ||
72 | 73 | ||
73 | @ save data back to struct | 74 | @ save data back to struct |
74 | ldr r0, =crossfeed_data + 4*4 | 75 | ldr r12, =crossfeed_data + 4*4 |
75 | stmia r0, { r8-r11 } @ save filter history | 76 | stmia r12, { r8-r11 } @ save filter history |
76 | str r12, [r0, #30*4] @ save delay line index | 77 | str r0, [r12, #30*4] @ save delay line index |
77 | add sp, sp, #8 @ remove temp variables from stack | 78 | add sp, sp, #8 @ remove temp variables from stack |
78 | ldmia sp!, { r4-r11, pc } | 79 | ldmia sp!, { r4-r11, pc } |
79 | 80 | ||