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"
42 #include "uart-target.h"
49 unsigned char* loadbuffer
;
52 int(*kernel_entry
)(void);
66 lcd_setfont(FONT_SYSFIXED
);
68 /* Show debug messages if button is pressed */
69 // if(button_read_device())
72 printf("Rockbox boot loader");
73 printf("Version %s", APPSVERSION
);
77 /* Enter USB mode without USB thread */
80 const char msg
[] = "Bootloader USB mode";
82 lcd_putsxy( (LCD_WIDTH
- (SYSFONT_WIDTH
* strlen(msg
))) / 2,
83 (LCD_HEIGHT
- SYSFONT_HEIGHT
) / 2, msg
);
86 ide_power_enable(true);
93 ata_spin(); /* Prevent the drive from spinning down */
103 int button
=0, *address
=0x0, count
=0;
106 button
= button_read_device();
107 if (button
== BUTTON_POWER
)
110 IO_GIO_BITSET1
|=1<<10;
112 if(button
==BUTTON_RC_PLAY
)
114 else if (button
==BUTTON_RC_DOWN
)
116 else if (button
==BUTTON_RC_FF
)
118 else if (button
==BUTTON_RC_REW
)
120 if (button
&BUTTON_TOUCHPAD
)
122 int touch
= button_get_last_touch();
123 printf("x: %d, y: %d", (touch
>>16), touch
&0xffff);
126 // if ((IO_GIO_BITSET0&(1<<14) == 0)
128 // short x,y,z1,z2, reg;
129 // extern int uart1count;
130 // tsc2100_read_values(&x, &y, &z1, &z2);
131 // printf("x: %04x y: %04x z1: %04x z2: %04x", x, y, z1, z2);
132 // printf("tsadc: %4x", tsc2100_readreg(TSADC_PAGE, TSADC_ADDRESS)&0xffff);
133 // printf("current tick: %04x", current_tick);
134 // printf("Address: 0x%08x Data: 0x%08x", address, *address);
135 // printf("Address: 0x%08x Data: 0x%08x", address+1, *(address+1));
136 // printf("Address: 0x%08x Data: 0x%08x", address+2, *(address+2));
137 // printf("uart1count: %d", uart1count);
138 // printf("%x %x", IO_UART1_RFCR & 0x3f, IO_UART1_DTRR & 0xff);
139 // tsc2100_keyclick(); /* doesnt work :( */
156 rc
= disk_mount_all();
162 printf("Loading firmware");
164 loadbuffer
= (unsigned char*) 0x00900000;
165 buffer_size
= (unsigned char*)0x00100000 - loadbuffer
;
167 rc
= load_firmware(loadbuffer
, BOOTFILE
, buffer_size
);
169 error(EBOOTFILE
, rc
);
173 kernel_entry
= (void*) loadbuffer
;