1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2007 by Karl Kurbjun
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 ****************************************************************************/
34 #include "backlight.h"
35 #include "backlight-target.h"
41 #include "rbunicode.h"
44 #include "uart-target.h"
47 #include "system-arm.h"
51 unsigned char* loadbuffer
;
54 int(*kernel_entry
)(void);
56 /* Make sure interrupts are disabled */
57 set_irq_level(IRQ_DISABLED
);
58 set_fiq_status(FIQ_DISABLED
);
62 /* Now enable interrupts */
63 set_irq_level(IRQ_ENABLED
);
64 set_fiq_status(FIQ_ENABLED
);
79 lcd_setfont(FONT_SYSFIXED
);
81 /* Show debug messages if button is pressed */
82 // if(button_read_device())
85 printf("Rockbox boot loader");
86 printf("Version %s", APPSVERSION
);
88 /* Enter USB mode without USB thread */
89 if(usb_detect() == USB_INSERTED
)
91 const char msg
[] = "Bootloader USB mode";
93 lcd_putsxy( (LCD_WIDTH
- (SYSFONT_WIDTH
* strlen(msg
))) / 2,
94 (LCD_HEIGHT
- SYSFONT_HEIGHT
) / 2, msg
);
97 ide_power_enable(true);
98 storage_enable(false);
102 while (usb_detect() == USB_INSERTED
)
104 storage_spin(); /* Prevent the drive from spinning down */
128 rc
= disk_mount_all();
134 printf("Loading firmware");
136 loadbuffer
= (unsigned char*) 0x00900000;
137 buffer_size
= (unsigned char*)0x01900000 - loadbuffer
;
139 rc
= load_firmware(loadbuffer
, BOOTFILE
, buffer_size
);
141 error(EBOOTFILE
, rc
);
145 kernel_entry
= (void*) loadbuffer
;