diff options
| author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-11-11 13:24:41 +0000 |
|---|---|---|
| committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-11-11 13:24:41 +0000 |
| commit | 1e524abd5b8d8966341b4f98c68bd0ca2ac3775e (patch) | |
| tree | a112b729b5fa7980e8ab85995e303529dbbfd860 | |
| parent | ddcc25a141a6dee89e2b8f986c14ef66141a52c0 (diff) | |
| download | rockbox-1e524abd5b8d8966341b4f98c68bd0ca2ac3775e.zip rockbox-1e524abd5b8d8966341b4f98c68bd0ca2ac3775e.tar.gz rockbox-1e524abd5b8d8966341b4f98c68bd0ca2ac3775e.tar.bz2 rockbox-1e524abd5b8d8966341b4f98c68bd0ca2ac3775e.tar.xz | |
Added a timeout debug panic for the recording DMA protocol
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2825 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/mpeg.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 4a7d37e..7f2d1d4 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c @@ -64,6 +64,7 @@ static int get_unswapped_space(void); #define MPEG_TRACK_CHANGE 101 #define MPEG_SAVE_DATA 102 #define MPEG_STOP_DONE 103 +#define MPEG_REC_TIMEOUT 104 enum { @@ -643,19 +644,31 @@ static void dma_tick(void) else { int i; + int x; int num_bytes = 0; if(recording && (PBDR & 0x4000)) { timing_info[timing_info_index++] = current_dma_tick; TCNT2 = 0; - for(i = 0;i < 30;i++) + for(i = 0;i < 30 && (PBDR & 0x4000);i++) { if(read_hw_mask() & PR_ACTIVE_HIGH) PADR |= 0x800; else PADR &= ~0x800; + + for(x = 2000;PBDR & 0x8000 && x;x--) {}; + + if(x == 0) + { + queue_post(&mpeg_queue, MPEG_REC_TIMEOUT, (void *)0); + if(read_hw_mask() & PR_ACTIVE_HIGH) + PADR &= ~0x800; + else + PADR |= 0x800; + break; + } - while(PBDR & 0x8000) {}; mp3buf[mp3buf_write] = *(unsigned char *)0x4000000; if(read_hw_mask() & PR_ACTIVE_HIGH) @@ -668,7 +681,17 @@ static void dma_tick(void) mp3buf_write = 0; num_bytes++; - while(!(PBDR & 0x8000)) {}; + + for(x = 2000;!(PBDR & 0x8000) && x;x--) {}; + if(x == 0) + { + queue_post(&mpeg_queue, MPEG_REC_TIMEOUT, (void *)1); + if(read_hw_mask() & PR_ACTIVE_HIGH) + PADR &= ~0x800; + else + PADR |= 0x800; + break; + } } timing_info[timing_info_index++] = TCNT2 + (num_bytes << 16); @@ -1569,6 +1592,12 @@ static void mpeg_thread(void) stop_pending = true; queue_post(&mpeg_queue, MPEG_SAVE_DATA, 0); break; + + case MPEG_REC_TIMEOUT: + if(mpeg_file >= 0) + close(mpeg_file); + panicf("Timeout: %d", (int)ev.data); + break; case MPEG_STOP_DONE: DEBUGF("MPEG_STOP_DONE\n"); |