1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2008 by Maurus Cuelenaere
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
24 #include "backlight.h"
35 static void show_splash(int timeout
, const char *msg
)
38 lcd_putsxy( (LCD_WIDTH
- (SYSFONT_WIDTH
* strlen(msg
))) / 2,
39 (LCD_HEIGHT
- SYSFONT_HEIGHT
) / 2, msg
);
45 static void usb_mode(void)
54 usb_start_monitoring();
56 /* Wait for threads to connect */
57 show_splash(HZ
/2, "Waiting for USB");
61 button
= button_get_w_tmo(HZ
/2);
63 if (button
== SYS_USB_CONNECTED
)
67 if (button
== SYS_USB_CONNECTED
)
69 /* Got the message - wait for disconnect */
70 show_splash(0, "Bootloader USB mode");
72 usb_acknowledge(SYS_USB_CONNECTED_ACK
);
76 button
= button_get(true);
77 if (button
== SYS_USB_DISCONNECTED
)
79 usb_acknowledge(SYS_USB_DISCONNECTED_ACK
);
88 static void boot_of(void)
97 void (*kernel_entry
)(void);
102 lcd_setfont(FONT_SYSFIXED
);
108 #ifdef HAVE_TOUCHSCREEN
109 rc
= button_read_device(&dummy
);
111 rc
= button_read_device();
114 if(rc
& BUTTON_VOL_UP
)
116 else if(button_hold())
121 /* Only enable backlight when button is pressed */
125 printf(MODEL_NAME
" Rockbox Bootloader");
126 printf("Version "APPSVERSION
);
133 rc
= disk_mount_all();
137 printf("Loading firmware");
138 rc
= load_firmware((unsigned char *)CONFIG_SDRAM_START
, BOOTFILE
, 0x400000);
140 printf("Error: %s", strerror(rc
));
144 printf("Starting Rockbox...");
146 kernel_entry
= (void*) CONFIG_SDRAM_START
;