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 | |
parent | b4ec73daaaa1b9abf3585fd07be71ff3624b13f3 (diff) |
More debug info
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2632 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/debug_menu.c | 13 | ||||
-rw-r--r-- | firmware/mpeg.c | 17 | ||||
-rw-r--r-- | firmware/mpeg.h | 9 |
3 files changed, 31 insertions, 8 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 9f71d14156..af8853d93c 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -38,6 +38,7 @@ #include "font.h" #include "disk.h" #include "mpeg.h" +#include "widgets.h" /*---------------------------------------------------*/ /* SPECIAL DEBUG STUFF */ @@ -137,8 +138,11 @@ bool dbg_mpeg_thread(void) { char buf[32]; int button; + int percent; struct mpeg_debug d; + lcd_setmargins(0, 0); + while(1) { button = button_get_w_tmo(HZ/5); @@ -164,6 +168,15 @@ bool dbg_mpeg_thread(void) lcd_puts(0, 4, buf); snprintf(buf, sizeof(buf), "unswapped: %x", d.unswapped_space); lcd_puts(0, 5, buf); + + percent = d.unplayed_space * 100 / d.mp3buflen; + progressbar(0, 6*8, 112, 4, percent, Grow_Right); + + percent = MPEG_LOW_WATER * 100 / d.mp3buflen; + progressbar(0, 6*8+4, 112, 4, percent, Grow_Right); + + snprintf(buf, sizeof(buf), "lowest: %x", d.lowest_watermark_level); + lcd_puts(0, 7, buf); lcd_update(); } 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, |