summaryrefslogtreecommitdiffstats
path: root/bootloader/main-pp.c
diff options
context:
space:
mode:
authorBarry Wardell <rockbox@barrywardell.net>2007-03-12 22:12:20 +0000
committerBarry Wardell <rockbox@barrywardell.net>2007-03-12 22:12:20 +0000
commit2370998a873f8be85825c8a3b0ccca5a9913c20e (patch)
treea6d5ea4bcf007d22a22f07e26fd98e114c6221b7 /bootloader/main-pp.c
parent62dbd97e909ccacf4165c65f676ee134bd1b880a (diff)
downloadrockbox-2370998a873f8be85825c8a3b0ccca5a9913c20e.tar.gz
rockbox-2370998a873f8be85825c8a3b0ccca5a9913c20e.tar.bz2
rockbox-2370998a873f8be85825c8a3b0ccca5a9913c20e.zip
Disable bootloader messages in the H10 and Sansa bootloaders unless the PLAY (on H10) or RIGHT (on Sansa) button is being held. Messages are still displayed if an error occurs. This has already been implemented for iPod bootloaders, but still needs implementing for the other bootloaders.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12742 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader/main-pp.c')
-rw-r--r--bootloader/main-pp.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/bootloader/main-pp.c b/bootloader/main-pp.c
index 5659073457..0f85404fc7 100644
--- a/bootloader/main-pp.c
+++ b/bootloader/main-pp.c
@@ -29,7 +29,17 @@
#include "ata.h"
#include "button.h"
#include "disk.h"
-#include "power.h"
+
+/* Button definitions */
+#if CONFIG_KEYPAD == IRIVER_H10_PAD
+#define BOOTLOADER_VERBOSE BUTTON_PLAY
+#define BOOTLOADER_BOOT_OF BUTTON_LEFT
+
+#elif CONFIG_KEYPAD == SANSA_E200_PAD
+#define BOOTLOADER_VERBOSE BUTTON_RIGHT
+#define BOOTLOADER_BOOT_OF BUTTON_LEFT
+
+#endif
/* Maximum allowed firmware image size. 10MB is more than enough */
#define MAX_LOADSIZE (10*1024*1024)
@@ -44,6 +54,7 @@ void* main(void)
{
char buf[256];
int i;
+ int btn;
int rc;
unsigned short* identify_info;
struct partinfo* pinfo;
@@ -54,6 +65,12 @@ void* main(void)
font_init();
button_init();
+ btn = button_read_device();
+
+ /* Enable bootloader messages */
+ if (btn==BOOTLOADER_VERBOSE)
+ verbose = true;
+
lcd_setfont(FONT_SYSFIXED);
printf("Rockbox boot loader");
@@ -73,25 +90,20 @@ void* main(void)
}
printf(buf);
} else {
- printf("ATA error: %d", i);
- udelay(5000000);
- power_off();
+ error(EATA, i);
}
disk_init();
rc = disk_mount_all();
if (rc<=0)
{
- printf("No partition found");
- udelay(5000000);
- power_off();
+ error(EDISK,rc);
}
pinfo = disk_partinfo(0);
printf("Partition 0: 0x%02x %ld MB", pinfo->type, pinfo->size / 2048);
- i=button_read_device();
- if(i==BUTTON_LEFT)
+ if(btn==BOOTLOADER_BOOT_OF)
{
/* Load original mi4 firmware. This expects a file called
"/System/OF.bin" on the player. It should be a mi4 firmware decrypted
@@ -101,21 +113,15 @@ void* main(void)
printf("Loading original firmware...");
rc=load_raw_firmware(loadbuffer, "/System/OF.bin", MAX_LOADSIZE);
if (rc < EOK) {
- printf("Error!");
- printf("Can't load /System/OF.bin:");
- printf(strerror(rc));
- udelay(5000000);
- power_off();
+ printf("Can't load /System/OF.bin");
+ error(EBOOTFILE, rc);
}
} else {
printf("Loading Rockbox...");
rc=load_firmware(loadbuffer, BOOTFILE, MAX_LOADSIZE);
if (rc < EOK) {
- printf("Error!");
printf("Can't load %s:", BOOTFILE);
- printf(strerror(rc));
- udelay(5000000);
- power_off();
+ error(EBOOTFILE, rc);
}
}