summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2005-06-30 20:02:56 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2005-06-30 20:02:56 +0000
commit87d4d1203c502b7ad0c90f39f3de2b48f7c4f9af (patch)
tree7073e5d076df6ccc2cb328484513777bb1dd61cf /firmware
parentf2af800fcb08f8918cbac69d9d70b4d8b60e52ac (diff)
downloadrockbox-87d4d1203c502b7ad0c90f39f3de2b48f7c4f9af.tar.gz
rockbox-87d4d1203c502b7ad0c90f39f3de2b48f7c4f9af.zip
Fixed a crash with pcm audio pausing. This should prevent many
crashes from happening. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6954 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/pcm_playback.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/firmware/pcm_playback.c b/firmware/pcm_playback.c
index 04630f100f..cad835e20e 100644
--- a/firmware/pcm_playback.c
+++ b/firmware/pcm_playback.c
@@ -137,6 +137,7 @@ static void dma_stop(void)
137{ 137{
138 pcm_playing = false; 138 pcm_playing = false;
139 139
140 DCR0 = 0;
140 /* Reset the FIFO */ 141 /* Reset the FIFO */
141 IIS2CONFIG = 0x800; 142 IIS2CONFIG = 0x800;
142} 143}
@@ -260,12 +261,19 @@ void pcm_play_pause(bool play)
260{ 261{
261 if(pcm_paused && play && pcmbuf_unplayed_bytes) 262 if(pcm_paused && play && pcmbuf_unplayed_bytes)
262 { 263 {
264 logf("unpause");
265 /* Reset chunk size so dma has enough data to fill the fifo. */
266 SAR0 = (unsigned long)next_start;
267 BCR0 = next_size;
263 /* Enable the FIFO and force one write to it */ 268 /* Enable the FIFO and force one write to it */
264 IIS2CONFIG = (pcm_freq << 12) | 0x300; 269 IIS2CONFIG = (pcm_freq << 12) | 0x300;
265 DCR0 |= DMA_START; 270 DCR0 |= DMA_EEXT | DMA_START;
266 } 271 }
267 else if(!pcm_paused && !play) 272 else if(!pcm_paused && !play)
268 { 273 {
274 logf("pause");
275 /* Disable DMA peripheral request. */
276 DCR0 &= ~DMA_EEXT;
269 IIS2CONFIG = 0x800; 277 IIS2CONFIG = 0x800;
270 } 278 }
271 pcm_paused = !play; 279 pcm_paused = !play;
@@ -283,7 +291,7 @@ void DMA0(void)
283 int res = DSR0; 291 int res = DSR0;
284 292
285 DSR0 = 1; /* Clear interrupt */ 293 DSR0 = 1; /* Clear interrupt */
286 294
287 /* Stop on error */ 295 /* Stop on error */
288 if(res & 0x70) 296 if(res & 0x70)
289 { 297 {