mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
backport r26663 : fix microphone recording on as3525v1
git-svn-id: svn://svn.rockbox.org/rockbox/branches/v3_6@26665 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
01fdf827f2
commit
164b7c9543
1 changed files with 17 additions and 7 deletions
|
@ -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 */
|
/* if needed, duplicate samples of the working channel until the given bound */
|
||||||
static inline void mono2stereo(int16_t *end)
|
static inline void mono2stereo(int16_t *end)
|
||||||
{
|
{
|
||||||
#if CONFIG_CPU == AS3525
|
|
||||||
if(audio_channels != 1) /* only for microphone */
|
if(audio_channels != 1) /* only for microphone */
|
||||||
return;
|
return;
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -286,11 +286,8 @@ static inline void mono2stereo(int16_t *end)
|
||||||
: "memory"
|
: "memory"
|
||||||
);
|
);
|
||||||
#endif /* C / ASM */
|
#endif /* C / ASM */
|
||||||
#else
|
|
||||||
/* microphone recording is stereo on as3525v2 */
|
|
||||||
(void)end;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_CPU == AS3525 */
|
||||||
|
|
||||||
static void rec_dma_callback(void)
|
static void rec_dma_callback(void)
|
||||||
{
|
{
|
||||||
|
@ -303,8 +300,10 @@ static void rec_dma_callback(void)
|
||||||
* pcm_rec_unlock() */
|
* pcm_rec_unlock() */
|
||||||
rec_dma_transfer_size = 0;
|
rec_dma_transfer_size = 0;
|
||||||
|
|
||||||
|
#if CONFIG_CPU == AS3525
|
||||||
/* the 2nd channel is silent when recording microphone on as3525v1 */
|
/* the 2nd channel is silent when recording microphone on as3525v1 */
|
||||||
mono2stereo(AS3525_UNCACHED_ADDR((int16_t*)rec_dma_start_addr));
|
mono2stereo(AS3525_UNCACHED_ADDR((int16_t*)rec_dma_start_addr));
|
||||||
|
#endif
|
||||||
|
|
||||||
if(locked)
|
if(locked)
|
||||||
{
|
{
|
||||||
|
@ -389,12 +388,23 @@ void pcm_rec_dma_init(void)
|
||||||
|
|
||||||
const void * pcm_rec_dma_get_peak_buffer(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));
|
int16_t *addr = AS3525_UNCACHED_ADDR((int16_t *)DMAC_CH_DST_ADDR(1));
|
||||||
mono2stereo(addr);
|
mono2stereo(addr);
|
||||||
pcm_rec_unlock();
|
restore_irq(old);
|
||||||
|
|
||||||
return addr;
|
return addr;
|
||||||
|
|
||||||
|
#else
|
||||||
|
/* Microphone recording is stereo on as3525v2 */
|
||||||
|
return AS3525_UNCACHED_ADDR((int16_t *)DMAC_CH_DST_ADDR(1));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_RECORDING */
|
#endif /* HAVE_RECORDING */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue