16 #include "backlight.h"
21 char version
[] = APPSVERSION
;
23 void go_usb_mode(void) {
24 /* Drop into USB mode. This does not check for disconnection. */
34 for (i
= 0; i
< 10000000; i
++) {continue;}
45 struct partinfo
* pinfo
;
46 unsigned short* identify_info
;
50 lcd_setfont(FONT_SYSFIXED
);
52 lcd_puts(0, line++, "Rockbox boot loader");
53 snprintf(buf, sizeof(buf), "Version: 20%s", version);
54 lcd_puts(0, line++, buf);
55 snprintf(buf, sizeof(buf), "Gigabeat version: 0x%08x", 1);
56 lcd_puts(0, line++, buf);
59 lcd_puts(0, line
++, "Hold MENU when booting for rescue mode.");
62 /* hold MENU to enter rescue mode */
64 lcd_puts(0, line
++, "Entering rescue mode..");
73 snprintf(buf
, sizeof(buf
), "disk_mount_all: %d", i
);
74 lcd_puts(0, line
++, buf
);
76 identify_info
= ata_get_identify();
78 for (i
=0; i
< 20; i
++)
79 ((unsigned short*)buf
)[i
]=htobe16(identify_info
[i
+27]);
83 /* kill trailing space */
84 for (i
=39; i
&& buf
[i
]==' '; i
--)
87 lcd_puts(0, line
++, "Model");
88 lcd_puts(0, line
++, buf
);
91 ((unsigned short*)buf
)[i
]=htobe16(identify_info
[i
+23]);
95 lcd_puts(0, line
++, "Firmware");
96 lcd_puts(0, line
++, buf
);
98 pinfo
= disk_partinfo(0);
99 snprintf(buf
, sizeof(buf
), "Partition 0: 0x%02x %ld MB",
100 pinfo
->type
, pinfo
->size
/ 2048);
101 lcd_puts(0, line
++, buf
);
103 testfile
= open("/boottest.txt", O_WRONLY
|O_CREAT
|O_TRUNC
);
104 write(testfile
, "It works!", 9);
109 /* now wait in USB mode so the bootloader can be updated */