From 4d55c2f4b7c207d32dc0d6fd055627e08f2b0561 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Thu, 10 Oct 2002 12:01:58 +0000 Subject: 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 --- apps/debug_menu.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ apps/debug_menu.h | 1 + apps/main.c | 11 ++++++++-- firmware/common/disk.c | 6 ++++++ firmware/common/disk.h | 1 + 5 files changed, 75 insertions(+), 2 deletions(-) diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 670f965eb2..dca95d6cf7 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -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) ); diff --git a/apps/debug_menu.h b/apps/debug_menu.h index 9b4841f653..4b2c193662 100644 --- a/apps/debug_menu.h +++ b/apps/debug_menu.h @@ -27,5 +27,6 @@ extern bool dbg_ports(void); extern bool dbg_rtc(void); #endif #endif +extern bool dbg_partitions(void); #endif diff --git a/apps/main.c b/apps/main.c index dedeea7a43..30d5f0878a 100644 --- a/apps/main.c +++ b/apps/main.c @@ -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(); diff --git a/firmware/common/disk.c b/firmware/common/disk.c index b662072d5f..b85f460a69 100644 --- a/firmware/common/disk.c +++ b/firmware/common/disk.c @@ -73,3 +73,9 @@ struct partinfo* disk_init(void) return part; } + +struct partinfo* disk_partinfo(int partition) +{ + return &part[partition]; +} + diff --git a/firmware/common/disk.h b/firmware/common/disk.h index 2d97e43d09..865b7bb4b4 100644 --- a/firmware/common/disk.h +++ b/firmware/common/disk.h @@ -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 -- cgit v1.2.3