summaryrefslogtreecommitdiff
path: root/apps/codecs/demac
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/demac')
-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
3 files changed, 71 insertions, 13 deletions
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: