void fatal_error(void) { extern int line; bool holdstatus=false; /* System font is 6 pixels wide */ #if defined(IPOD_1G2G) || defined(IPOD_3G) printf("Insert Firewire cable, or"); printf("hold MENU+PLAY to reboot"); printf("then REW+FF for disk mode"); #elif LCD_WIDTH >= (30*6) printf("Insert USB cable, or"); printf("hold MENU+SELECT to reboot"); printf("then SELECT+PLAY for disk mode"); #else printf("Insert USB cable, or"); printf("hold MENU+SELECT to"); printf("reboot then SELECT+PLAY"); printf("for disk mode"); #endif lcd_update(); usb_init(); while (1) { if (button_hold() != holdstatus) { if (button_hold()) { holdstatus=true; lcd_puts(0, line, "Hold switch on!"); } else { holdstatus=false; lcd_puts(0, line, " "); } lcd_update(); } if (usb_detect() == USB_INSERTED) { ata_sleepnow(); /* Immediately spindown the disk. */ sleep(HZ*2); #if CONFIG_CPU == PP5020 memcpy((void *)0x40017f00, "diskmode\0\0hotstuff\0\0\1", 21); #elif CONFIG_CPU == PP5022 memcpy((void *)0x4001ff00, "diskmode\0\0hotstuff\0\0\1", 21); #elif CONFIG_CPU == PP5002 memcpy((void *)0x40017f00, "diskmodehotstuff\1", 17); #endif /* CONFIG_CPU */ system_reboot(); /* Reboot */ } udelay(100000); /* 100ms */ } }
void shutdown(void) { /* We need to gracefully spin down the disk to prevent clicks. */ if (ide_powered()) { /* Make sure ATA has been initialized. */ ata_init(); /* And put the disk into sleep immediately. */ ata_sleepnow(); } backlight_hw_off(); power_off(); }
void usb_enable(bool on) { /* This device specific code will eventually give way to proper USB handling, which should be the same for all PP5002 targets. */ if (on) { #ifdef IPOD_ARCH /* For iPod, we can only do one thing with USB mode atm - reboot into the flash-based disk-mode. This does not return. */ ata_sleepnow(); /* Immediately spindown the disk. */ sleep(HZ*2); memcpy((void *)0x40017f00, "diskmodehotstuff\1", 17); system_reboot(); /* Reboot */ #endif } }