summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/codecs/codecs.make10
-rw-r--r--apps/codecs/demac/libdemac.make17
-rw-r--r--apps/codecs/demac/libdemac/udiv32_arm-pre.S25
-rw-r--r--apps/codecs/demac/libdemac/udiv32_arm.S42
4 files changed, 80 insertions, 14 deletions
diff --git a/apps/codecs/codecs.make b/apps/codecs/codecs.make
index 9e1f909462..0c3d2fade0 100644
--- a/apps/codecs/codecs.make
+++ b/apps/codecs/codecs.make
@@ -59,7 +59,7 @@ CODECLIBS := $(DEMACLIB) $(A52LIB) $(ALACLIB) $(ASAPLIB) \
59 $(ATRACLIB) \ 59 $(ATRACLIB) \
60 $(CODECLIB) 60 $(CODECLIB)
61 61
62$(CODECS): $(CODEC_CRT0) $(CODECLINK_LDS) 62$(CODECS): $(CODEC_CRT0) $(CODECLINK_LDS)
63 63
64$(CODECLINK_LDS): $(CODEC_LDS) $(CONFIGFILE) 64$(CODECLINK_LDS): $(CODEC_LDS) $(CONFIGFILE)
65 $(call PRINTS,PP $(@F)) 65 $(call PRINTS,PP $(@F))
@@ -78,6 +78,7 @@ $(CODECDIR)/wavpack.codec : $(CODECDIR)/libwavpack.a
78$(CODECDIR)/alac.codec : $(CODECDIR)/libalac.a $(CODECDIR)/libm4a.a 78$(CODECDIR)/alac.codec : $(CODECDIR)/libalac.a $(CODECDIR)/libm4a.a
79$(CODECDIR)/aac.codec : $(CODECDIR)/libfaad.a $(CODECDIR)/libm4a.a 79$(CODECDIR)/aac.codec : $(CODECDIR)/libfaad.a $(CODECDIR)/libm4a.a
80$(CODECDIR)/shorten.codec : $(CODECDIR)/libffmpegFLAC.a 80$(CODECDIR)/shorten.codec : $(CODECDIR)/libffmpegFLAC.a
81$(CODECDIR)/ape-pre.map : $(CODECDIR)/libdemac-pre.a
81$(CODECDIR)/ape.codec : $(CODECDIR)/libdemac.a 82$(CODECDIR)/ape.codec : $(CODECDIR)/libdemac.a
82$(CODECDIR)/wma.codec : $(CODECDIR)/libwma.a 83$(CODECDIR)/wma.codec : $(CODECDIR)/libwma.a
83$(CODECDIR)/wavpack_enc.codec: $(CODECDIR)/libwavpack.a 84$(CODECDIR)/wavpack_enc.codec: $(CODECDIR)/libwavpack.a
@@ -113,6 +114,13 @@ else
113 CODECFLAGS += -UDEBUG -DNDEBUG 114 CODECFLAGS += -UDEBUG -DNDEBUG
114endif 115endif
115 116
117$(CODECDIR)/%-pre.map: $(CODEC_CRT0) $(CODECLINK_LDS) $(CODECDIR)/%.o $(CODECLIB)
118 $(call PRINTS,LD $(@F))$(CC) $(CODECFLAGS) -o $(CODECDIR)/$*-pre.elf \
119 $(filter %.o, $^) \
120 $(filter-out $(CODECLIB),$(filter %.a, $+)) \
121 $(CODECLIB) \
122 -lgcc $(subst .map,-pre.map,$(CODECLDFLAGS))
123
116$(CODECDIR)/%.codec: $(CODECDIR)/%.o 124$(CODECDIR)/%.codec: $(CODECDIR)/%.o
117 $(call PRINTS,LD $(@F))$(CC) $(CODECFLAGS) -o $(CODECDIR)/$*.elf \ 125 $(call PRINTS,LD $(@F))$(CC) $(CODECFLAGS) -o $(CODECDIR)/$*.elf \
118 $(filter %.o, $^) \ 126 $(filter %.o, $^) \
diff --git a/apps/codecs/demac/libdemac.make b/apps/codecs/demac/libdemac.make
index 5026fb1d95..dcbd35c6b1 100644
--- a/apps/codecs/demac/libdemac.make
+++ b/apps/codecs/demac/libdemac.make
@@ -12,6 +12,15 @@ DEMACLIB := $(CODECDIR)/libdemac.a
12DEMACLIB_SRC := $(call preprocess, $(APPSDIR)/codecs/demac/libdemac/SOURCES) 12DEMACLIB_SRC := $(call preprocess, $(APPSDIR)/codecs/demac/libdemac/SOURCES)
13DEMACLIB_OBJ := $(call c2obj, $(DEMACLIB_SRC)) 13DEMACLIB_OBJ := $(call c2obj, $(DEMACLIB_SRC))
14OTHER_SRC += $(DEMACLIB_SRC) 14OTHER_SRC += $(DEMACLIB_SRC)
15ifeq ($(CPU),arm)
16OTHER_SRC += $(APPSDIR)/codecs/demac/libdemac/udiv32_arm-pre.S
17endif
18DEMACLIB_PRE := $(subst .a,-pre.a,$(DEMACLIB))
19DEMACLIB_OBJ_PRE := $(subst udiv32_arm.o,udiv32_arm-pre.o,$(DEMACLIB_OBJ))
20
21$(DEMACLIB_PRE): $(DEMACLIB_OBJ_PRE)
22 $(SILENT)$(shell rm -f $@)
23 $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null
15 24
16$(DEMACLIB): $(DEMACLIB_OBJ) 25$(DEMACLIB): $(DEMACLIB_OBJ)
17 $(SILENT)$(shell rm -f $@) 26 $(SILENT)$(shell rm -f $@)
@@ -20,6 +29,14 @@ $(DEMACLIB): $(DEMACLIB_OBJ)
20DEMACFLAGS = $(filter-out -O%,$(CODECFLAGS)) 29DEMACFLAGS = $(filter-out -O%,$(CODECFLAGS))
21DEMACFLAGS += -O3 30DEMACFLAGS += -O3
22 31
32$(CODECDIR)/ape_free_iram.h: $(CODECDIR)/ape-pre.map
33 $(call PRINTS,GEN $(@F))perl -an \
34 -e 'if(/^PLUGIN_IRAM/){$$istart=hex($$F[1]);$$ilen=hex($$F[2])}' \
35 -e 'if(/iend = /){$$iend=hex($$F[0]);}' \
36 -e '}{if($$ilen){print"#define FREE_IRAM ".($$ilen+$$istart-$$iend)."\n";}' \
37 $(CODECDIR)/ape-pre.map \
38 > $@
39
23$(CODECDIR)/demac/%.o: $(ROOTDIR)/apps/codecs/demac/%.c 40$(CODECDIR)/demac/%.o: $(ROOTDIR)/apps/codecs/demac/%.c
24 $(SILENT)mkdir -p $(dir $@) 41 $(SILENT)mkdir -p $(dir $@)
25 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(DEMACFLAGS) -c $< -o $@ 42 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(DEMACFLAGS) -c $< -o $@
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
107udiv32_arm: 123udiv32_arm: