diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-06-07 16:17:32 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-06-07 16:17:32 +0000 |
commit | 4eea33e27d5cb9d5e98d230581529a36a529151a (patch) | |
tree | 2de1f4a50c38ba077cf68e24998495d2e11669d2 /firmware/target | |
parent | f84c22fc390d7d7846a7b75a33755de58587227c (diff) |
as3525v1: fix r26444 which broke mic recording
preventing the DMA callback to advance in the recording buffer is not
enough in pcm_rec_dma_get_peak_buffer()
we need to prevent it interrupting us while we are copying the left
channel data into the right channel
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26663 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/arm/as3525/pcm-as3525.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/firmware/target/arm/as3525/pcm-as3525.c b/firmware/target/arm/as3525/pcm-as3525.c index 6794875e49..bb91bfad65 100644 --- a/firmware/target/arm/as3525/pcm-as3525.c +++ b/firmware/target/arm/as3525/pcm-as3525.c @@ -257,10 +257,10 @@ static void rec_dma_start(void) } +#if CONFIG_CPU == AS3525 /* if needed, duplicate samples of the working channel until the given bound */ static inline void mono2stereo(int16_t *end) { -#if CONFIG_CPU == AS3525 if(audio_channels != 1) /* only for microphone */ return; #if 0 @@ -286,11 +286,8 @@ static inline void mono2stereo(int16_t *end) : "memory" ); #endif /* C / ASM */ -#else - /* microphone recording is stereo on as3525v2 */ - (void)end; -#endif } +#endif /* CONFIG_CPU == AS3525 */ static void rec_dma_callback(void) { @@ -303,8 +300,10 @@ static void rec_dma_callback(void) * pcm_rec_unlock() */ rec_dma_transfer_size = 0; +#if CONFIG_CPU == AS3525 /* the 2nd channel is silent when recording microphone on as3525v1 */ mono2stereo(AS3525_UNCACHED_ADDR((int16_t*)rec_dma_start_addr)); +#endif if(locked) { @@ -389,12 +388,23 @@ void pcm_rec_dma_init(void) const void * pcm_rec_dma_get_peak_buffer(void) { - pcm_rec_lock(); +#if CONFIG_CPU == AS3525 + /* + * We need to prevent the DMA callback from kicking in while we are + * faking the right channel with data from left channel. + */ + + int old = disable_irq_save(); int16_t *addr = AS3525_UNCACHED_ADDR((int16_t *)DMAC_CH_DST_ADDR(1)); mono2stereo(addr); - pcm_rec_unlock(); + restore_irq(old); return addr; + +#else + /* Microphone recording is stereo on as3525v2 */ + return AS3525_UNCACHED_ADDR((int16_t *)DMAC_CH_DST_ADDR(1)); +#endif } #endif /* HAVE_RECORDING */ |