1
0
Fork 0
forked from len0rd/rockbox

Changed pausing so entire chunk is finished and keeps I2S engine aligned

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12020 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Steve Gotthardt 2007-01-16 03:36:32 +00:00
parent 2127071653
commit cd05dbc7f4

View file

@ -90,18 +90,17 @@ void pcm_init(void)
audiohw_init(); audiohw_init();
audiohw_enable_output(true); audiohw_enable_output(true);
audiohw_mute(true);
/* cannot use the WM8975 defaults since our clock is not the same */ /* cannot use the WM8975 defaults since our clock is not the same */
/* the input master clock is 16.9344MHz - we can divide exact for that */ /* the input master clock is 16.9344MHz - we can divide exact for that */
audiohw_set_sample_rate( (0<<6) | (0x11 << 1) | (0<<0)); pcm_set_frequency(SAMPR_44);
/* init GPIO */ /* init GPIO */
GPCCON = (GPCCON & ~(3<<14)) | (1<<14); GPCCON = (GPCCON & ~(3<<14)) | (1<<14);
GPCDAT |= 1<<7; GPCDAT |= 1<<7;
GPECON |= 0x2aa; GPECON |= 0x2aa;
/* Do no service DMA0 requests, yet */ /* Do not service DMA requests, yet */
/* clear any pending int and mask it */ /* clear any pending int and mask it */
INTMSK |= (1<<19); /* mask the interrupt */ INTMSK |= (1<<19); /* mask the interrupt */
SRCPND = (1<<19); /* clear any pending interrupts */ SRCPND = (1<<19); /* clear any pending interrupts */
@ -113,13 +112,14 @@ void pcm_init(void)
void pcm_play_dma_start(const void *addr, size_t size) void pcm_play_dma_start(const void *addr, size_t size)
{ {
static short value;
/* sanity check: bad pointer or too small file */ /* sanity check: bad pointer or too small file */
if ((NULL == addr) || (size & ~1) <= IIS_FIFO_SIZE) return; if (NULL == addr || size <= IIS_FIFO_SIZE) return;
p = (unsigned short *)addr; p = (unsigned short *)addr;
p_size = size; p_size = size;
/* Enable the IIS clock */ /* Enable the IIS clock */
CLKCON |= (1<<17); CLKCON |= (1<<17);
@ -177,24 +177,24 @@ void pcm_play_dma_start(const void *addr, size_t size)
/* Disconnect the DMA and wait for the FIFO to clear */ /* Disconnect the DMA and wait for the FIFO to clear */
void pcm_play_dma_stop(void) void pcm_play_dma_stop(void)
{ {
pcm_playing = false;
/* mask the DMA interrupt */ /* mask the DMA interrupt */
INTMSK |= (1<<19); INTMSK |= (1<<19);
/* De-Activate the channel */ /* are we playing? wait for the chunk to finish */
if (pcm_playing)
{
/* wait for the FIFO to empty before turning things off */
while (IISCON & (1<<7)) ;
pcm_playing = false;
}
/* De-Activate the DMA channel */
DMASKTRIG2 = 0x4; DMASKTRIG2 = 0x4;
/* idle the IIS transmit */ /* Disconnect the IIS clock */
IISCON |= (1<<3);
/* stop the IIS interface */
IISCON &= ~(1<<0);
/* Disconnect the IIS IIS clock */
CLKCON &= ~(1<<17); CLKCON &= ~(1<<17);
disable_fiq(); disable_fiq();
} }
@ -203,16 +203,16 @@ void pcm_play_dma_stop(void)
void pcm_play_pause_pause(void) void pcm_play_pause_pause(void)
{ {
/* idle */ /* stop servicing refills */
IISCON |= (1<<3); INTMSK |= (1<<19);
} }
void pcm_play_pause_unpause(void) void pcm_play_pause_unpause(void)
{ {
/* no idle */ /* refill buffer and keep going */
IISCON &= ~(1<<3); INTMSK &= ~(1<<19);
} }