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"
36 static void show_splash(int timeout
, const char *msg
)
39 lcd_putsxy( (LCD_WIDTH
- (SYSFONT_WIDTH
* strlen(msg
))) / 2,
40 (LCD_HEIGHT
- SYSFONT_HEIGHT
) / 2, msg
);
46 static void usb_mode(void)
55 usb_start_monitoring();
57 /* Wait for threads to connect */
58 show_splash(HZ
/2, "Waiting for USB");
62 button
= button_get_w_tmo(HZ
/2);
64 if (button
== SYS_USB_CONNECTED
)
68 if (button
== SYS_USB_CONNECTED
)
70 /* Got the message - wait for disconnect */
71 show_splash(0, "Bootloader USB mode");
73 usb_acknowledge(SYS_USB_CONNECTED_ACK
);
77 button
= button_get(true);
78 if (button
== SYS_USB_DISCONNECTED
)
80 usb_acknowledge(SYS_USB_DISCONNECTED_ACK
);
89 static void boot_of(void)
98 #ifdef HAVE_TOUCHSCREEN
101 void (*kernel_entry
)(void);
106 lcd_setfont(FONT_SYSFIXED
);
113 #ifdef HAVE_TOUCHSCREEN
114 rc
= button_read_device(&dummy
);
116 rc
= button_read_device();
119 if(rc
& BUTTON_VOL_UP
)
121 else if(button_hold())
126 /* Only enable backlight when button is pressed */
130 printf(MODEL_NAME
" Rockbox Bootloader");
131 printf("Version "APPSVERSION
);
138 rc
= disk_mount_all();
142 printf("Loading firmware");
143 rc
= load_firmware((unsigned char *)CONFIG_SDRAM_START
, BOOTFILE
, 0x400000);
145 printf("Error: %s", strerror(rc
));
149 printf("Starting Rockbox...");
150 adc_close(); /* Disable SADC */
152 kernel_entry
= (void*) CONFIG_SDRAM_START
;