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"
25 #include "backlight-target.h"
37 static void show_splash(int timeout
, const char *msg
)
40 lcd_putsxy( (LCD_WIDTH
- (SYSFONT_WIDTH
* strlen(msg
))) / 2,
41 (LCD_HEIGHT
- SYSFONT_HEIGHT
) / 2, msg
);
47 static void usb_mode(void)
53 usb_start_monitoring();
55 /* Wait for threads to connect */
56 show_splash(HZ
/2, "Waiting for USB");
60 button
= button_get_w_tmo(HZ
/2);
62 if (button
== SYS_USB_CONNECTED
)
66 if (button
== SYS_USB_CONNECTED
)
68 /* Got the message - wait for disconnect */
69 show_splash(0, "Bootloader USB mode");
71 usb_acknowledge(SYS_USB_CONNECTED_ACK
);
75 button
= button_get(true);
76 if (button
== SYS_USB_DISCONNECTED
)
78 usb_acknowledge(SYS_USB_DISCONNECTED_ACK
);
87 static void boot_of(void)
95 #ifdef HAVE_TOUCHSCREEN
98 void (*kernel_entry
)(void);
103 lcd_setfont(FONT_SYSFIXED
);
109 printf(MODEL_NAME
" Rockbox Bootloader");
110 printf("Version "APPSVERSION
);
116 #ifdef HAVE_TOUCHSCREEN
117 rc
= button_read_device(&dummy
);
119 rc
= button_read_device();
122 if(rc
& BUTTON_VOL_UP
)
124 else if(button_hold())
127 rc
= disk_mount_all();
131 printf("Loading firmware");
132 rc
= load_firmware((unsigned char *)CONFIG_SDRAM_START
, BOOTFILE
, 0x400000);
134 printf("Error: %s", strerror(rc
));
138 printf("Starting Rockbox...");
139 adc_close(); /* Disable SADC */
140 _backlight_off(); /* Force backlight off to prevent LCD 'flicker' */
143 kernel_entry
= (void*) CONFIG_SDRAM_START
;