summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-10-15 07:23:18 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-10-15 07:23:18 +0000
commitbf303de4ddda21248a9b77a6d6b2e8bb4631cace (patch)
treeb47b013d685b8fb6c9f4386e7b56e6f08093d9f1 /firmware
parentb4ec73daaaa1b9abf3585fd07be71ff3624b13f3 (diff)
downloadrockbox-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.c17
-rw-r--r--firmware/mpeg.h9
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);
static int get_unplayed_space(void);
static int get_unswapped_space(void);
-#define MPEG_SWAP_CHUNKSIZE 0x2000
-#define MPEG_HIGH_WATER 2 /* We leave 2 bytes empty because otherwise we
- wouldn't be able to see the difference between
- an empty buffer and a full one. */
-#define MPEG_LOW_WATER 0x40000
-#define MPEG_LOW_WATER_CHUNKSIZE 0x40000
-
#define MPEG_PLAY 1
#define MPEG_STOP 2
#define MPEG_PAUSE 3
@@ -439,7 +432,8 @@ static bool is_playing; /* We are (attempting to) playing MP3 files */
static bool filling; /* We are filling the buffer with data from disk */
static bool dma_underrun; /* True when the DMA has stopped because of
slow disk reading (read error, shaking) */
-
+static int lowest_watermark_level; /* Debug value to observe the buffer
+ usage */
static int mpeg_file;
void mpeg_get_debugdata(struct mpeg_debug *dbgdata)
@@ -460,6 +454,8 @@ void mpeg_get_debugdata(struct mpeg_debug *dbgdata)
dbgdata->unplayed_space = get_unplayed_space();
dbgdata->unswapped_space = get_unswapped_space();
+
+ dbgdata->lowest_watermark_level = lowest_watermark_level;
}
static void mas_poll_start(int interval_in_ms)
@@ -598,6 +594,7 @@ static void reset_mp3_buffer(void)
mp3buf_read = 0;
mp3buf_write = 0;
mp3buf_swapwrite = 0;
+ lowest_watermark_level = mp3buflen;
}
#pragma interrupt
@@ -662,6 +659,10 @@ void DEI3(void)
DTCR3 = last_dma_chunk_size & 0xffff;
SAR3 = (unsigned int)mp3buf + mp3buf_read;
id3tags[tag_read_idx]->id3.offset += last_dma_chunk_size;
+
+ /* Update the watermark debug level */
+ if(unplayed_space_left < lowest_watermark_level)
+ lowest_watermark_level = unplayed_space_left;
}
else
{
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 @@
#include <stdbool.h>
+#define MPEG_SWAP_CHUNKSIZE 0x2000
+#define MPEG_HIGH_WATER 2 /* We leave 2 bytes empty because otherwise we
+ wouldn't be able to see the difference between
+ an empty buffer and a full one. */
+#define MPEG_LOW_WATER 0x40000
+#define MPEG_LOW_WATER_CHUNKSIZE 0x40000
+
struct mpeg_debug
{
int mp3buflen;
@@ -39,6 +46,8 @@ struct mpeg_debug
int unplayed_space;
int unswapped_space;
+
+ int lowest_watermark_level;
};
void mpeg_init(int volume, int bass, int treble, int balance,