summaryrefslogtreecommitdiff
path: root/apps/dsp.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dsp.c')
-rw-r--r--apps/dsp.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/apps/dsp.c b/apps/dsp.c
index 8064a881a3..23b7ea548d 100644
--- a/apps/dsp.c
+++ b/apps/dsp.c
@@ -43,7 +43,6 @@
43 43
44#if defined(CPU_COLDFIRE) && !defined(SIMULATOR) 44#if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
45 45
46#define INIT() asm volatile ("move.l #0xb0, %macsr") /* frac, round, clip */
47/* Multiply two S.31 fractional integers and return the sign bit and the 46/* Multiply two S.31 fractional integers and return the sign bit and the
48 * 31 most significant bits of the result. 47 * 31 most significant bits of the result.
49 */ 48 */
@@ -89,7 +88,6 @@
89 88
90#else 89#else
91 90
92#define INIT()
93#define FRACMUL(x, y) (long) (((((long long) (x)) * ((long long) (y))) >> 31)) 91#define FRACMUL(x, y) (long) (((((long long) (x)) * ((long long) (y))) >> 31))
94#define FRACMUL_8(x, y) (long) (((((long long) (x)) * ((long long) (y))) >> 23)) 92#define FRACMUL_8(x, y) (long) (((((long long) (x)) * ((long long) (y))) >> 23))
95#define FRACMUL_8_LOOP(x, y, s) \ 93#define FRACMUL_8_LOOP(x, y, s) \
@@ -492,11 +490,17 @@ long dsp_process(char* dst, char* src[], long size)
492 long factor; 490 long factor;
493 int samples; 491 int samples;
494 492
493 #if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
494 /* set emac unit for dsp processing, and save old macsr, we're running in
495 codec thread context at this point, so can't clobber it */
496 unsigned long old_macsr = coldfire_get_macsr();
497 coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_ROUND | EMAC_SATURATE);
498 #endif
499
495 dsp = &dsp_conf[current_codec]; 500 dsp = &dsp_conf[current_codec];
496 501
497 factor = (dsp->stereo_mode != STEREO_MONO) ? 2 : 1; 502 factor = (dsp->stereo_mode != STEREO_MONO) ? 2 : 1;
498 size /= dsp->sample_bytes * factor; 503 size /= dsp->sample_bytes * factor;
499 INIT();
500 dsp_set_replaygain(false); 504 dsp_set_replaygain(false);
501 505
502 while (size > 0) 506 while (size > 0)
@@ -510,7 +514,10 @@ long dsp_process(char* dst, char* src[], long size)
510 dst += samples * sizeof(short) * 2; 514 dst += samples * sizeof(short) * 2;
511 yield(); 515 yield();
512 } 516 }
513 517 #if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
518 /* set old macsr again */
519 coldfire_set_macsr(old_macsr);
520 #endif
514 return written * sizeof(short) * 2; 521 return written * sizeof(short) * 2;
515} 522}
516 523