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"
41 #include "spi-target.h"
42 #include "uart-target.h"
46 unsigned char* loadbuffer
;
49 int(*kernel_entry
)(void);
62 lcd_setfont(FONT_SYSFIXED
);
64 /* Show debug messages if button is pressed */
65 // if(button_read_device())
68 printf("Rockbox boot loader");
69 printf("Version %s", APPSVERSION
);
74 /* Enter USB mode without USB thread */
77 const char msg
[] = "Bootloader USB mode";
79 lcd_putsxy( (LCD_WIDTH
- (SYSFONT_WIDTH
* strlen(msg
))) / 2,
80 (LCD_HEIGHT
- SYSFONT_HEIGHT
) / 2, msg
);
83 ide_power_enable(true);
90 ata_spin(); /* Prevent the drive from spinning down */
103 outw(inw(IO_GIO_DIR1
)&~(1<<10), IO_GIO_DIR1
); // set GIO26 to output
106 if (button_read_device() == BUTTON_POWER
)
109 outw(1<<10, IO_GIO_BITSET1
);
112 // Read X, Y, Z1, Z2 touchscreen coordinates.
113 int page
= 0, address
= 0;
114 unsigned short command
= 0x8000|(page
<< 11)|(address
<< 5);
115 unsigned char out
[] = {command
>> 8, command
& 0xff};
117 dm320_spi_block_transfer(out
, sizeof(out
), in
, sizeof(in
));
119 printf("%02x%02x %02x%02x %02x%02x %02x%02x\n",
137 rc
= disk_mount_all();
143 printf("Loading firmware");
145 loadbuffer
= (unsigned char*) 0x00900000;
146 buffer_size
= (unsigned char*)0x00100000 - loadbuffer
;
148 rc
= load_firmware(loadbuffer
, BOOTFILE
, buffer_size
);
150 error(EBOOTFILE
, rc
);
154 kernel_entry
= (void*) loadbuffer
;