summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--firmware/asm/arm/pcm-mixer-armv4.c (renamed from firmware/target/arm/pcm-mixer-armv4.c)0
-rw-r--r--firmware/asm/arm/pcm-mixer-armv5.c (renamed from firmware/target/arm/pcm-mixer-armv5.c)0
-rw-r--r--firmware/asm/arm/pcm-mixer-armv6.c (renamed from firmware/target/arm/pcm-mixer-armv6.c)0
-rw-r--r--firmware/asm/arm/pcm-mixer.c7
-rw-r--r--firmware/asm/generic/pcm-mixer.c100
-rw-r--r--firmware/asm/m68k/pcm-mixer.c (renamed from firmware/target/coldfire/pcm-mixer-coldfire.c)0
-rw-r--r--firmware/asm/pcm-mixer.c108
-rw-r--r--firmware/pcm_mixer.c104
8 files changed, 217 insertions, 102 deletions
diff --git a/firmware/target/arm/pcm-mixer-armv4.c b/firmware/asm/arm/pcm-mixer-armv4.c
index 4818544d7b..4818544d7b 100644
--- a/firmware/target/arm/pcm-mixer-armv4.c
+++ b/firmware/asm/arm/pcm-mixer-armv4.c
diff --git a/firmware/target/arm/pcm-mixer-armv5.c b/firmware/asm/arm/pcm-mixer-armv5.c
index 64f2c86f52..64f2c86f52 100644
--- a/firmware/target/arm/pcm-mixer-armv5.c
+++ b/firmware/asm/arm/pcm-mixer-armv5.c
diff --git a/firmware/target/arm/pcm-mixer-armv6.c b/firmware/asm/arm/pcm-mixer-armv6.c
index 94eecd0f90..94eecd0f90 100644
--- a/firmware/target/arm/pcm-mixer-armv6.c
+++ b/firmware/asm/arm/pcm-mixer-armv6.c
diff --git a/firmware/asm/arm/pcm-mixer.c b/firmware/asm/arm/pcm-mixer.c
new file mode 100644
index 0000000000..16c9c3575d
--- /dev/null
+++ b/firmware/asm/arm/pcm-mixer.c
@@ -0,0 +1,7 @@
+#if ARM_ARCH >= 6
+ #include "pcm-mixer-armv6.c"
+#elif ARM_ARCH >= 5
+ #include "pcm-mixer-armv5.c"
+#elif ARM_ARCH >= 4
+ #include "pcm-mixer-armv4.c"
+#endif
diff --git a/firmware/asm/generic/pcm-mixer.c b/firmware/asm/generic/pcm-mixer.c
new file mode 100644
index 0000000000..93841be70d
--- /dev/null
+++ b/firmware/asm/generic/pcm-mixer.c
@@ -0,0 +1,100 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2011 by Michael Sevakis
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "dsp-util.h" /* for clip_sample_16 */
+/* Mix channels' samples and apply gain factors */
+static FORCE_INLINE void mix_samples(uint32_t *out,
+ int16_t *src0,
+ int32_t src0_amp,
+ int16_t *src1,
+ int32_t src1_amp,
+ size_t size)
+{
+ if (src0_amp == MIX_AMP_UNITY && src1_amp == MIX_AMP_UNITY)
+ {
+ /* Both are unity amplitude */
+ do
+ {
+ int32_t l = *src0++ + *src1++;
+ int32_t h = *src0++ + *src1++;
+ *out++ = (uint16_t)clip_sample_16(l) | (clip_sample_16(h) << 16);
+ }
+ while ((size -= 4) > 0);
+ }
+ else if (src0_amp != MIX_AMP_UNITY && src1_amp != MIX_AMP_UNITY)
+ {
+ /* Neither are unity amplitude */
+ do
+ {
+ int32_t l = (*src0++ * src0_amp >> 16) + (*src1++ * src1_amp >> 16);
+ int32_t h = (*src0++ * src0_amp >> 16) + (*src1++ * src1_amp >> 16);
+ *out++ = (uint16_t)clip_sample_16(l) | (clip_sample_16(h) << 16);
+ }
+ while ((size -= 4) > 0);
+ }
+ else
+ {
+ /* One is unity amplitude */
+ if (src0_amp != MIX_AMP_UNITY)
+ {
+ /* Keep unity in src0, amp0 */
+ int16_t *src_tmp = src0;
+ src0 = src1;
+ src1 = src_tmp;
+ src1_amp = src0_amp;
+ src0_amp = MIX_AMP_UNITY;
+ }
+
+ do
+ {
+ int32_t l = *src0++ + (*src1++ * src1_amp >> 16);
+ int32_t h = *src0++ + (*src1++ * src1_amp >> 16);
+ *out++ = (uint16_t)clip_sample_16(l) | (clip_sample_16(h) << 16);
+ }
+ while ((size -= 4) > 0);
+ }
+}
+
+/* Write channel's samples and apply gain factor */
+static FORCE_INLINE void write_samples(uint32_t *out,
+ int16_t *src,
+ int32_t amp,
+ size_t size)
+{
+ if (LIKELY(amp == MIX_AMP_UNITY))
+ {
+ /* Channel is unity amplitude */
+ memcpy(out, src, size);
+ }
+ else
+ {
+ /* Channel needs amplitude cut */
+ do
+ {
+ int32_t l = *src++ * amp >> 16;
+ int32_t h = *src++ * amp & 0xffff0000;
+ *out++ = (uint16_t)l | h;
+ }
+ while ((size -= 4) > 0);
+ }
+}
+
+#endif
diff --git a/firmware/target/coldfire/pcm-mixer-coldfire.c b/firmware/asm/m68k/pcm-mixer.c
index d8318fffaf..d8318fffaf 100644
--- a/firmware/target/coldfire/pcm-mixer-coldfire.c
+++ b/firmware/asm/m68k/pcm-mixer.c
diff --git a/firmware/asm/pcm-mixer.c b/firmware/asm/pcm-mixer.c
new file mode 100644
index 0000000000..369e830427
--- /dev/null
+++ b/firmware/asm/pcm-mixer.c
@@ -0,0 +1,108 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2011 by Michael Sevakis
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#if defined(CPU_ARM)
+ #include "arm/pcm-mixer.c"
+#elif defined(CPU_COLDFIRE)
+ #include "m68k/pcm-mixer.c"
+#else
+
+/* generic pcm-mixer.c */
+#include "dsp-util.h" /* for clip_sample_16 */
+/* Mix channels' samples and apply gain factors */
+static FORCE_INLINE void mix_samples(uint32_t *out,
+ int16_t *src0,
+ int32_t src0_amp,
+ int16_t *src1,
+ int32_t src1_amp,
+ size_t size)
+{
+ if (src0_amp == MIX_AMP_UNITY && src1_amp == MIX_AMP_UNITY)
+ {
+ /* Both are unity amplitude */
+ do
+ {
+ int32_t l = *src0++ + *src1++;
+ int32_t h = *src0++ + *src1++;
+ *out++ = (uint16_t)clip_sample_16(l) | (clip_sample_16(h) << 16);
+ }
+ while ((size -= 4) > 0);
+ }
+ else if (src0_amp != MIX_AMP_UNITY && src1_amp != MIX_AMP_UNITY)
+ {
+ /* Neither are unity amplitude */
+ do
+ {
+ int32_t l = (*src0++ * src0_amp >> 16) + (*src1++ * src1_amp >> 16);
+ int32_t h = (*src0++ * src0_amp >> 16) + (*src1++ * src1_amp >> 16);
+ *out++ = (uint16_t)clip_sample_16(l) | (clip_sample_16(h) << 16);
+ }
+ while ((size -= 4) > 0);
+ }
+ else
+ {
+ /* One is unity amplitude */
+ if (src0_amp != MIX_AMP_UNITY)
+ {
+ /* Keep unity in src0, amp0 */
+ int16_t *src_tmp = src0;
+ src0 = src1;
+ src1 = src_tmp;
+ src1_amp = src0_amp;
+ src0_amp = MIX_AMP_UNITY;
+ }
+
+ do
+ {
+ int32_t l = *src0++ + (*src1++ * src1_amp >> 16);
+ int32_t h = *src0++ + (*src1++ * src1_amp >> 16);
+ *out++ = (uint16_t)clip_sample_16(l) | (clip_sample_16(h) << 16);
+ }
+ while ((size -= 4) > 0);
+ }
+}
+
+/* Write channel's samples and apply gain factor */
+static FORCE_INLINE void write_samples(uint32_t *out,
+ int16_t *src,
+ int32_t amp,
+ size_t size)
+{
+ if (LIKELY(amp == MIX_AMP_UNITY))
+ {
+ /* Channel is unity amplitude */
+ memcpy(out, src, size);
+ }
+ else
+ {
+ /* Channel needs amplitude cut */
+ do
+ {
+ int32_t l = *src++ * amp >> 16;
+ int32_t h = *src++ * amp & 0xffff0000;
+ *out++ = (uint16_t)l | h;
+ }
+ while ((size -= 4) > 0);
+ }
+}
+
+
+#endif
diff --git a/firmware/pcm_mixer.c b/firmware/pcm_mixer.c
index 25c41c2586..0038b0f5e7 100644
--- a/firmware/pcm_mixer.c
+++ b/firmware/pcm_mixer.c
@@ -70,108 +70,8 @@ static struct mixer_channel * active_channels[PCM_MIXER_NUM_CHANNELS+1] IBSS_ATT
#define MAX_IDLE_FRAMES (NATIVE_FREQUENCY*3 / MIX_FRAME_SAMPLES)
static unsigned int idle_counter = 0;
-#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
-
-/* Include any implemented CPU-optimized mixdown routines */
-#if defined(CPU_ARM)
-#if ARM_ARCH >= 6
-#include "pcm-mixer-armv6.c"
-#elif ARM_ARCH >= 5
-#include "pcm-mixer-armv5.c"
-#else
-#include "pcm-mixer-armv4.c"
-#endif /* ARM_ARCH */
-#elif defined (CPU_COLDFIRE)
-#include "pcm-mixer-coldfire.c"
-#endif /* CPU_* */
-
-#endif /* CONFIG_PLATFORM */
-
-/** Generic mixing routines **/
-
-#ifndef MIXER_OPTIMIZED_MIX_SAMPLES
-#include "dsp-util.h" /* for clip_sample_16 */
-
-/* Mix channels' samples and apply gain factors */
-static FORCE_INLINE void mix_samples(uint32_t *out,
- int16_t *src0,
- int32_t src0_amp,
- int16_t *src1,
- int32_t src1_amp,
- size_t size)
-{
- if (src0_amp == MIX_AMP_UNITY && src1_amp == MIX_AMP_UNITY)
- {
- /* Both are unity amplitude */
- do
- {
- int32_t l = *src0++ + *src1++;
- int32_t h = *src0++ + *src1++;
- *out++ = (uint16_t)clip_sample_16(l) | (clip_sample_16(h) << 16);
- }
- while ((size -= 4) > 0);
- }
- else if (src0_amp != MIX_AMP_UNITY && src1_amp != MIX_AMP_UNITY)
- {
- /* Neither are unity amplitude */
- do
- {
- int32_t l = (*src0++ * src0_amp >> 16) + (*src1++ * src1_amp >> 16);
- int32_t h = (*src0++ * src0_amp >> 16) + (*src1++ * src1_amp >> 16);
- *out++ = (uint16_t)clip_sample_16(l) | (clip_sample_16(h) << 16);
- }
- while ((size -= 4) > 0);
- }
- else
- {
- /* One is unity amplitude */
- if (src0_amp != MIX_AMP_UNITY)
- {
- /* Keep unity in src0, amp0 */
- int16_t *src_tmp = src0;
- src0 = src1;
- src1 = src_tmp;
- src1_amp = src0_amp;
- src0_amp = MIX_AMP_UNITY;
- }
-
- do
- {
- int32_t l = *src0++ + (*src1++ * src1_amp >> 16);
- int32_t h = *src0++ + (*src1++ * src1_amp >> 16);
- *out++ = (uint16_t)clip_sample_16(l) | (clip_sample_16(h) << 16);
- }
- while ((size -= 4) > 0);
- }
-}
-#endif /* MIXER_OPTIMIZED_MIX_SAMPLES */
-
-#ifndef MIXER_OPTIMIZED_WRITE_SAMPLES
-/* Write channel's samples and apply gain factor */
-static FORCE_INLINE void write_samples(uint32_t *out,
- int16_t *src,
- int32_t amp,
- size_t size)
-{
- if (LIKELY(amp == MIX_AMP_UNITY))
- {
- /* Channel is unity amplitude */
- memcpy(out, src, size);
- }
- else
- {
- /* Channel needs amplitude cut */
- do
- {
- int32_t l = *src++ * amp >> 16;
- int32_t h = *src++ * amp & 0xffff0000;
- *out++ = (uint16_t)l | h;
- }
- while ((size -= 4) > 0);
- }
-}
-#endif /* MIXER_OPTIMIZED_WRITE_SAMPLES */
-
+/** Mixing routines, CPU optmized **/
+#include "asm/pcm-mixer.c"
/** Private generic routines **/