1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2007 by Karl Kurbjun
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
32 #include "backlight.h"
33 #include "backlight-target.h"
39 #include "rbunicode.h"
44 unsigned char* loadbuffer
;
47 int(*kernel_entry
)(void);
60 lcd_setfont(FONT_SYSFIXED
);
62 /* Show debug messages if button is pressed */
63 // if(button_read_device())
66 printf("Rockbox boot loader");
67 printf("Version %s", APPSVERSION
);
72 /* Enter USB mode without USB thread */
75 const char msg
[] = "Bootloader USB mode";
77 lcd_putsxy( (LCD_WIDTH
- (SYSFONT_WIDTH
* strlen(msg
))) / 2,
78 (LCD_HEIGHT
- SYSFONT_HEIGHT
) / 2, msg
);
81 ide_power_enable(true);
88 ata_spin(); /* Prevent the drive from spinning down */
100 int count
= 0, i
= 0, c
= 0;
102 unsigned short out
[] = {0x8000};
103 unsigned short in
[2];
104 outw(inw(IO_GIO_DIR1
)&~(1<<10), IO_GIO_DIR1
); // set GIO26 to output
108 if (button_read_device() == BUTTON_POWER
)
111 outw(1<<10, IO_GIO_BITSET1
);
113 // dm320_spi_block_transfer(0, out, 16, 16, in, 0);
114 // printf("%x", in[0]);
129 rc
= disk_mount_all();
135 printf("Loading firmware");
137 loadbuffer
= (unsigned char*) 0x00900000;
138 buffer_size
= (unsigned char*)0x00100000 - loadbuffer
;
140 rc
= load_firmware(loadbuffer
, BOOTFILE
, buffer_size
);
142 error(EBOOTFILE
, rc
);
146 kernel_entry
= (void*) loadbuffer
;