Partition debug screen added, and jumped to when no fat32 partition is found at boot.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2558 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2002-10-10 12:01:58 +00:00
parent 1a7bc7edef
commit 4d55c2f4b7
5 changed files with 75 additions and 2 deletions

View file

@ -36,6 +36,7 @@
#include "powermgmt.h"
#include "system.h"
#include "font.h"
#include "disk.h"
/*---------------------------------------------------*/
/* SPECIAL DEBUG STUFF */
@ -261,6 +262,62 @@ bool dbg_hw_info(void)
}
#endif
bool dbg_partitions(void)
{
int partition=0;
lcd_clear_display();
lcd_puts(0, 0, "Partition");
lcd_puts(0, 1, "list");
lcd_update();
sleep(HZ);
while(1)
{
char buf[32];
int button;
struct partinfo* p = disk_partinfo(partition);
lcd_clear_display();
snprintf(buf, sizeof buf, "P%d: S:%x", partition, p->start);
lcd_puts(0, 0, buf);
snprintf(buf, sizeof buf, "T:%x %d MB", p->type, p->size / 2048);
lcd_puts(0, 1, buf);
lcd_update();
button = button_get(true);
switch(button)
{
#ifdef HAVE_RECORDER_KEYPAD
case BUTTON_OFF:
#else
case BUTTON_STOP:
#endif
return false;
#ifdef HAVE_RECORDER_KEYPAD
case BUTTON_UP:
#endif
case BUTTON_LEFT:
partition--;
if (partition < 0)
partition = 3;
break;
#ifdef HAVE_RECORDER_KEYPAD
case BUTTON_DOWN:
#endif
case BUTTON_RIGHT:
partition++;
if (partition > 3)
partition = 0;
break;
}
}
return false;
}
#ifdef HAVE_LCD_BITMAP
/* Test code!!! */
bool dbg_ports(void)
@ -910,6 +967,7 @@ bool debug_menu(void)
{ "View battery", view_battery },
#endif
{ "View HW info", dbg_hw_info },
{ "View partitions", dbg_partitions },
};
m=menu_init( items, sizeof items / sizeof(struct menu_items) );

View file

@ -27,5 +27,6 @@ extern bool dbg_ports(void);
extern bool dbg_rtc(void);
#endif
#endif
extern bool dbg_partitions(void);
#endif

View file

@ -141,8 +141,15 @@ void init(void)
if ( i==4 ) {
DEBUGF("No partition found, trying to mount sector 0.\n");
rc = fat_mount(0);
if(rc)
panicf("No FAT32 partition!");
if(rc) {
lcd_clear_display();
lcd_puts(0,0,"No FAT32");
lcd_puts(0,1,"partition!");
lcd_update();
sleep(HZ);
while(1)
dbg_partitions();
}
}
settings_load();

View file

@ -73,3 +73,9 @@ struct partinfo* disk_init(void)
return part;
}
struct partinfo* disk_partinfo(int partition)
{
return &part[partition];
}

View file

@ -30,5 +30,6 @@ struct partinfo {
/* returns a pointer to an array of 8 partinfo structs */
struct partinfo* disk_init(void);
struct partinfo* disk_partinfo(int partition);
#endif