diff options
Diffstat (limited to 'apps/codecs/demac/libdemac')
-rw-r--r-- | apps/codecs/demac/libdemac/udiv32_arm-pre.S | 25 | ||||
-rw-r--r-- | apps/codecs/demac/libdemac/udiv32_arm.S | 42 |
2 files changed, 54 insertions, 13 deletions
diff --git a/apps/codecs/demac/libdemac/udiv32_arm-pre.S b/apps/codecs/demac/libdemac/udiv32_arm-pre.S new file mode 100644 index 0000000000..882d9b6f50 --- /dev/null +++ b/apps/codecs/demac/libdemac/udiv32_arm-pre.S | |||
@@ -0,0 +1,25 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 by Andrew Mahone | ||
11 | * | ||
12 | * Wrapper for udiv32_arm.S to test available IRAM by pre-linking the codec. | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | |||
24 | #define APE_PRE | ||
25 | #include "udiv32_arm.S" \ No newline at end of file | ||
diff --git a/apps/codecs/demac/libdemac/udiv32_arm.S b/apps/codecs/demac/libdemac/udiv32_arm.S index 4492492d30..939fce17d4 100644 --- a/apps/codecs/demac/libdemac/udiv32_arm.S +++ b/apps/codecs/demac/libdemac/udiv32_arm.S | |||
@@ -29,6 +29,13 @@ | |||
29 | ****************************************************************************/ | 29 | ****************************************************************************/ |
30 | 30 | ||
31 | #include "config.h" | 31 | #include "config.h" |
32 | /* On targets with codec iram, a header file will be generated after an initial | ||
33 | link of the APE codec, stating the amount of IRAM remaining for use by the | ||
34 | reciprocal lookup table. */ | ||
35 | #if !defined(APE_PRE) && defined(USE_IRAM) && ARM_ARCH < 5 | ||
36 | #include "apps/codecs/ape_free_iram.h" | ||
37 | #endif | ||
38 | |||
32 | /* Codecs should not normally do this, but we need to check a macro, and | 39 | /* Codecs should not normally do this, but we need to check a macro, and |
33 | * codecs.h would confuse the assembler. */ | 40 | * codecs.h would confuse the assembler. */ |
34 | 41 | ||
@@ -88,20 +95,29 @@ | |||
88 | eor \quotient, \result, \remainder, lsl \bits | 95 | eor \quotient, \result, \remainder, lsl \bits |
89 | .endm | 96 | .endm |
90 | 97 | ||
91 | #ifdef CPU_PP | 98 | #ifndef FREE_IRAM |
92 | #if CONFIG_CPU == PP5020 | 99 | .set recip_max, 2 |
93 | .set recip_max, 8384 | ||
94 | #elif CONFIG_CPU == PP5002 | ||
95 | .set recip_max, 4608 | ||
96 | #else | 100 | #else |
97 | .set recip_max, 16384 | 101 | /* Each table entry is one word. Since a compare is done against the maximum |
98 | #endif | 102 | entry as an immediate, the maximum entry must be a valid ARM immediate, |
99 | #elif CONFIG_CPU == AS3525 | 103 | which means a byte shifted by an even number of places. */ |
100 | .set recip_max, 42752 | 104 | .set recip_max, 2 + FREE_IRAM / 4 |
101 | #elif CONFIG_CPU == S5L8701 | 105 | .set recip_max_tmp, recip_max >> 8 |
102 | .set recip_max, 12800 | 106 | .set recip_mask_shift, 0 |
103 | #elif CONFIG_CPU == S5L8700 | 107 | .set tmp_shift, 16 |
104 | .set recip_max, 9088 | 108 | .rept 5 |
109 | .if recip_max_tmp >> tmp_shift | ||
110 | .set recip_max_tmp, recip_max_tmp >> tmp_shift | ||
111 | .set recip_mask_shift, recip_mask_shift + tmp_shift | ||
112 | .endif | ||
113 | .set tmp_shift, tmp_shift >> 1 | ||
114 | .endr | ||
115 | .if recip_max_tmp | ||
116 | .set recip_mask_shift, recip_mask_shift + 1 | ||
117 | .endif | ||
118 | .set recip_mask_shift, (recip_mask_shift + 1) & 62 | ||
119 | .set recip_max, recip_max & (255 << recip_mask_shift) | ||
120 | //.set recip_max, 2 | ||
105 | #endif | 121 | #endif |
106 | 122 | ||
107 | udiv32_arm: | 123 | udiv32_arm: |