From cd05dbc7f4f402db6b6f52fcfaf5af622792d08f Mon Sep 17 00:00:00 2001 From: Steve Gotthardt Date: Tue, 16 Jan 2007 03:36:32 +0000 Subject: 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 --- firmware/target/arm/gigabeat/meg-fx/pcm-meg-fx.c | 38 ++++++++++++------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/firmware/target/arm/gigabeat/meg-fx/pcm-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/pcm-meg-fx.c index 38d300ae52..c68c359441 100644 --- a/firmware/target/arm/gigabeat/meg-fx/pcm-meg-fx.c +++ b/firmware/target/arm/gigabeat/meg-fx/pcm-meg-fx.c @@ -90,18 +90,17 @@ void pcm_init(void) audiohw_init(); audiohw_enable_output(true); - audiohw_mute(true); /* 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 */ - audiohw_set_sample_rate( (0<<6) | (0x11 << 1) | (0<<0)); + pcm_set_frequency(SAMPR_44); /* init GPIO */ GPCCON = (GPCCON & ~(3<<14)) | (1<<14); GPCDAT |= 1<<7; GPECON |= 0x2aa; - /* Do no service DMA0 requests, yet */ + /* Do not service DMA requests, yet */ /* clear any pending int and mask it */ INTMSK |= (1<<19); /* mask the interrupt */ 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) { + static short value; + /* 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_size = size; - /* Enable the IIS clock */ 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 */ void pcm_play_dma_stop(void) { - pcm_playing = false; - /* mask the DMA interrupt */ INTMSK |= (1<<19); - /* De-Activate the channel */ - DMASKTRIG2 = 0x4; + /* 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)) ; - /* idle the IIS transmit */ - IISCON |= (1<<3); + pcm_playing = false; + } - /* stop the IIS interface */ - IISCON &= ~(1<<0); + /* De-Activate the DMA channel */ + DMASKTRIG2 = 0x4; - /* Disconnect the IIS IIS clock */ + /* Disconnect the IIS clock */ CLKCON &= ~(1<<17); - disable_fiq(); } @@ -203,16 +203,16 @@ void pcm_play_dma_stop(void) void pcm_play_pause_pause(void) { - /* idle */ - IISCON |= (1<<3); + /* stop servicing refills */ + INTMSK |= (1<<19); } void pcm_play_pause_unpause(void) { - /* no idle */ - IISCON &= ~(1<<3); + /* refill buffer and keep going */ + INTMSK &= ~(1<<19); } -- cgit v1.2.3