summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorne Wuff <torne@wolfpuppy.org.uk>2010-04-13 22:17:42 +0000
committerTorne Wuff <torne@wolfpuppy.org.uk>2010-04-13 22:17:42 +0000
commit0d24df8b952c105cf8e532ff48b636bc81945938 (patch)
treed26a07f45b66aa8fc35ff8bec22aa15823fc037e
parentbab155890033e94a83c60ea3ac62f7483ef4b4db (diff)
downloadrockbox-0d24df8b952c105cf8e532ff48b636bc81945938.tar.gz
rockbox-0d24df8b952c105cf8e532ff48b636bc81945938.zip
FS#11199: ipod bootloader: reboot to disk mode on cable insert, following a fatal error
If the ipod bootloader dies with a fatal error it prompts you to press buttons to reset and enter disk mode. With this change it now also polls for USB/firewire insertion and if the cable is detected, it reboots to disk mode directly for you, avoiding user problems with rebooting correctly by hand. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25643 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--bootloader/ipod.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/bootloader/ipod.c b/bootloader/ipod.c
index e5538b280c..ee555793d0 100644
--- a/bootloader/ipod.c
+++ b/bootloader/ipod.c
@@ -43,6 +43,7 @@
43#include "file.h" 43#include "file.h"
44#include "common.h" 44#include "common.h"
45#include "hwcompat.h" 45#include "hwcompat.h"
46#include "usb.h"
46 47
47#define XSC(X) #X 48#define XSC(X) #X
48#define SC(X) XSC(X) 49#define SC(X) XSC(X)
@@ -58,12 +59,6 @@ unsigned char *loadbuffer = (unsigned char *)DRAM_START;
58/* Bootloader version */ 59/* Bootloader version */
59char version[] = APPSVERSION; 60char version[] = APPSVERSION;
60 61
61#define BUTTON_LEFT 1
62#define BUTTON_MENU 2
63#define BUTTON_RIGHT 3
64#define BUTTON_PLAY 4
65#define BUTTON_HOLD 5
66
67#if CONFIG_KEYPAD == IPOD_4G_PAD && !defined(IPOD_MINI) 62#if CONFIG_KEYPAD == IPOD_4G_PAD && !defined(IPOD_MINI)
68/* check if number of seconds has past */ 63/* check if number of seconds has past */
69int timer_check(int clock_start, unsigned int usecs) 64int timer_check(int clock_start, unsigned int usecs)
@@ -193,19 +188,22 @@ void fatal_error(void)
193 188
194 /* System font is 6 pixels wide */ 189 /* System font is 6 pixels wide */
195#if defined(IPOD_1G2G) || defined(IPOD_3G) 190#if defined(IPOD_1G2G) || defined(IPOD_3G)
196 printf("Hold MENU+PLAY to"); 191 printf("Insert Firewire cable, or");
197 printf("reboot then REW+FF"); 192 printf("hold MENU+PLAY to reboot");
198 printf("for disk mode"); 193 printf("then REW+FF for disk mode");
199#elif LCD_WIDTH >= (30*6) 194#elif LCD_WIDTH >= (30*6)
200 printf("Hold MENU+SELECT to reboot"); 195 printf("Insert USB cable, or");
196 printf("hold MENU+SELECT to reboot");
201 printf("then SELECT+PLAY for disk mode"); 197 printf("then SELECT+PLAY for disk mode");
202#else 198#else
203 printf("Hold MENU+SELECT to"); 199 printf("Insert USB cable, or");
200 printf("hold MENU+SELECT to");
204 printf("reboot then SELECT+PLAY"); 201 printf("reboot then SELECT+PLAY");
205 printf("for disk mode"); 202 printf("for disk mode");
206#endif 203#endif
207 lcd_update(); 204 lcd_update();
208 205
206 usb_init();
209 while (1) { 207 while (1) {
210 if (button_hold() != holdstatus) { 208 if (button_hold() != holdstatus) {
211 if (button_hold()) { 209 if (button_hold()) {
@@ -217,6 +215,18 @@ void fatal_error(void)
217 } 215 }
218 lcd_update(); 216 lcd_update();
219 } 217 }
218 if (usb_detect() == USB_INSERTED) {
219 ata_sleepnow(); /* Immediately spindown the disk. */
220 sleep(HZ*2);
221#if CONFIG_CPU == PP5020
222 memcpy((void *)0x40017f00, "diskmode\0\0hotstuff\0\0\1", 21);
223#elif CONFIG_CPU == PP5022
224 memcpy((void *)0x4001ff00, "diskmode\0\0hotstuff\0\0\1", 21);
225#elif CONFIG_CPU == PP5002
226 memcpy((void *)0x40017f00, "diskmodehotstuff\1", 17);
227#endif /* CONFIG_CPU */
228 system_reboot(); /* Reboot */
229 }
220 udelay(100000); /* 100ms */ 230 udelay(100000); /* 100ms */
221 } 231 }
222 232