diff options
author | Thom Johansen <thomj@rockbox.org> | 2005-09-07 00:24:27 +0000 |
---|---|---|
committer | Thom Johansen <thomj@rockbox.org> | 2005-09-07 00:24:27 +0000 |
commit | 735208a541df024f1cd3b9624054b6ed9724ad1e (patch) | |
tree | 01b8b91e8f473207553e2c94a5f6f00a6f60f3b4 /apps/dsp.c | |
parent | 4cd06c41f62c217681ec91557e89dc4461bab6d3 (diff) | |
download | rockbox-735208a541df024f1cd3b9624054b6ed9724ad1e.tar.gz rockbox-735208a541df024f1cd3b9624054b6ed9724ad1e.zip |
Adapted codecs and DSP system to having MACSR saved in thread context.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7485 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/dsp.c')
-rw-r--r-- | apps/dsp.c | 15 |
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 @@ #if defined(CPU_COLDFIRE) && !defined(SIMULATOR) -#define INIT() asm volatile ("move.l #0xb0, %macsr") /* frac, round, clip */ /* Multiply two S.31 fractional integers and return the sign bit and the * 31 most significant bits of the result. */ @@ -89,7 +88,6 @@ #else -#define INIT() #define FRACMUL(x, y) (long) (((((long long) (x)) * ((long long) (y))) >> 31)) #define FRACMUL_8(x, y) (long) (((((long long) (x)) * ((long long) (y))) >> 23)) #define FRACMUL_8_LOOP(x, y, s) \ @@ -492,11 +490,17 @@ long dsp_process(char* dst, char* src[], long size) long factor; int samples; + #if defined(CPU_COLDFIRE) && !defined(SIMULATOR) + /* set emac unit for dsp processing, and save old macsr, we're running in + codec thread context at this point, so can't clobber it */ + unsigned long old_macsr = coldfire_get_macsr(); + coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_ROUND | EMAC_SATURATE); + #endif + dsp = &dsp_conf[current_codec]; factor = (dsp->stereo_mode != STEREO_MONO) ? 2 : 1; size /= dsp->sample_bytes * factor; - INIT(); dsp_set_replaygain(false); while (size > 0) @@ -510,7 +514,10 @@ long dsp_process(char* dst, char* src[], long size) dst += samples * sizeof(short) * 2; yield(); } - + #if defined(CPU_COLDFIRE) && !defined(SIMULATOR) + /* set old macsr again */ + coldfire_set_macsr(old_macsr); + #endif return written * sizeof(short) * 2; } |