diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-10-15 07:23:18 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-10-15 07:23:18 +0000 |
commit | bf303de4ddda21248a9b77a6d6b2e8bb4631cace (patch) | |
tree | b47b013d685b8fb6c9f4386e7b56e6f08093d9f1 /firmware | |
parent | b4ec73daaaa1b9abf3585fd07be71ff3624b13f3 (diff) | |
download | rockbox-bf303de4ddda21248a9b77a6d6b2e8bb4631cace.tar.gz rockbox-bf303de4ddda21248a9b77a6d6b2e8bb4631cace.zip |
More debug info
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2632 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/mpeg.c | 17 | ||||
-rw-r--r-- | firmware/mpeg.h | 9 |
2 files changed, 18 insertions, 8 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index d7e7acbf92..9937c3be47 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c | |||
@@ -40,13 +40,6 @@ extern void bitswap(unsigned char *data, int length); | |||
40 | static int get_unplayed_space(void); | 40 | static int get_unplayed_space(void); |
41 | static int get_unswapped_space(void); | 41 | static int get_unswapped_space(void); |
42 | 42 | ||
43 | #define MPEG_SWAP_CHUNKSIZE 0x2000 | ||
44 | #define MPEG_HIGH_WATER 2 /* We leave 2 bytes empty because otherwise we | ||
45 | wouldn't be able to see the difference between | ||
46 | an empty buffer and a full one. */ | ||
47 | #define MPEG_LOW_WATER 0x40000 | ||
48 | #define MPEG_LOW_WATER_CHUNKSIZE 0x40000 | ||
49 | |||
50 | #define MPEG_PLAY 1 | 43 | #define MPEG_PLAY 1 |
51 | #define MPEG_STOP 2 | 44 | #define MPEG_STOP 2 |
52 | #define MPEG_PAUSE 3 | 45 | #define MPEG_PAUSE 3 |
@@ -439,7 +432,8 @@ static bool is_playing; /* We are (attempting to) playing MP3 files */ | |||
439 | static bool filling; /* We are filling the buffer with data from disk */ | 432 | static bool filling; /* We are filling the buffer with data from disk */ |
440 | static bool dma_underrun; /* True when the DMA has stopped because of | 433 | static bool dma_underrun; /* True when the DMA has stopped because of |
441 | slow disk reading (read error, shaking) */ | 434 | slow disk reading (read error, shaking) */ |
442 | 435 | static int lowest_watermark_level; /* Debug value to observe the buffer | |
436 | usage */ | ||
443 | static int mpeg_file; | 437 | static int mpeg_file; |
444 | 438 | ||
445 | void mpeg_get_debugdata(struct mpeg_debug *dbgdata) | 439 | void mpeg_get_debugdata(struct mpeg_debug *dbgdata) |
@@ -460,6 +454,8 @@ void mpeg_get_debugdata(struct mpeg_debug *dbgdata) | |||
460 | 454 | ||
461 | dbgdata->unplayed_space = get_unplayed_space(); | 455 | dbgdata->unplayed_space = get_unplayed_space(); |
462 | dbgdata->unswapped_space = get_unswapped_space(); | 456 | dbgdata->unswapped_space = get_unswapped_space(); |
457 | |||
458 | dbgdata->lowest_watermark_level = lowest_watermark_level; | ||
463 | } | 459 | } |
464 | 460 | ||
465 | static void mas_poll_start(int interval_in_ms) | 461 | static void mas_poll_start(int interval_in_ms) |
@@ -598,6 +594,7 @@ static void reset_mp3_buffer(void) | |||
598 | mp3buf_read = 0; | 594 | mp3buf_read = 0; |
599 | mp3buf_write = 0; | 595 | mp3buf_write = 0; |
600 | mp3buf_swapwrite = 0; | 596 | mp3buf_swapwrite = 0; |
597 | lowest_watermark_level = mp3buflen; | ||
601 | } | 598 | } |
602 | 599 | ||
603 | #pragma interrupt | 600 | #pragma interrupt |
@@ -662,6 +659,10 @@ void DEI3(void) | |||
662 | DTCR3 = last_dma_chunk_size & 0xffff; | 659 | DTCR3 = last_dma_chunk_size & 0xffff; |
663 | SAR3 = (unsigned int)mp3buf + mp3buf_read; | 660 | SAR3 = (unsigned int)mp3buf + mp3buf_read; |
664 | id3tags[tag_read_idx]->id3.offset += last_dma_chunk_size; | 661 | id3tags[tag_read_idx]->id3.offset += last_dma_chunk_size; |
662 | |||
663 | /* Update the watermark debug level */ | ||
664 | if(unplayed_space_left < lowest_watermark_level) | ||
665 | lowest_watermark_level = unplayed_space_left; | ||
665 | } | 666 | } |
666 | else | 667 | else |
667 | { | 668 | { |
diff --git a/firmware/mpeg.h b/firmware/mpeg.h index 97a1b36c1a..02c5e814a2 100644 --- a/firmware/mpeg.h +++ b/firmware/mpeg.h | |||
@@ -21,6 +21,13 @@ | |||
21 | 21 | ||
22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
23 | 23 | ||
24 | #define MPEG_SWAP_CHUNKSIZE 0x2000 | ||
25 | #define MPEG_HIGH_WATER 2 /* We leave 2 bytes empty because otherwise we | ||
26 | wouldn't be able to see the difference between | ||
27 | an empty buffer and a full one. */ | ||
28 | #define MPEG_LOW_WATER 0x40000 | ||
29 | #define MPEG_LOW_WATER_CHUNKSIZE 0x40000 | ||
30 | |||
24 | struct mpeg_debug | 31 | struct mpeg_debug |
25 | { | 32 | { |
26 | int mp3buflen; | 33 | int mp3buflen; |
@@ -39,6 +46,8 @@ struct mpeg_debug | |||
39 | 46 | ||
40 | int unplayed_space; | 47 | int unplayed_space; |
41 | int unswapped_space; | 48 | int unswapped_space; |
49 | |||
50 | int lowest_watermark_level; | ||
42 | }; | 51 | }; |
43 | 52 | ||
44 | void mpeg_init(int volume, int bass, int treble, int balance, | 53 | void mpeg_init(int volume, int bass, int treble, int balance, |