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();
108 printf("btn: %x", button
);
109 if (button
== BUTTON_POWER
)
112 IO_GIO_BITSET1
|=1<<10;
114 if(button
==BUTTON_RC_PLAY
)
116 else if (button
==BUTTON_RC_DOWN
)
118 else if (button
==BUTTON_RC_FF
)
120 else if (button
==BUTTON_RC_REW
)
123 // if ((IO_GIO_BITSET0&(1<<14) == 0)
125 short x
,y
,z1
,z2
, reg
;
126 extern int uart1count
;
127 tsc2100_read_values(&x
, &y
, &z1
, &z2
);
128 printf("x: %04x y: %04x z1: %04x z2: %04x", x
, y
, z1
, z2
);
129 printf("tsadc: %4x", tsc2100_readreg(TSADC_PAGE
, TSADC_ADDRESS
)&0xffff);
130 printf("current tick: %04x", current_tick
);
131 printf("Address: 0x%08x Data: 0x%08x", address
, *address
);
132 printf("Address: 0x%08x Data: 0x%08x", address
+1, *(address
+1));
133 printf("Address: 0x%08x Data: 0x%08x", address
+2, *(address
+2));
134 printf("uart1count: %d", uart1count
);
135 printf("%x %x", IO_UART1_RFCR
& 0x3f, IO_UART1_DTRR
& 0xff);
136 tsc2100_keyclick(); /* doesnt work :( */
153 rc
= disk_mount_all();
159 printf("Loading firmware");
161 loadbuffer
= (unsigned char*) 0x00900000;
162 buffer_size
= (unsigned char*)0x00100000 - loadbuffer
;
164 rc
= load_firmware(loadbuffer
, BOOTFILE
, buffer_size
);
166 error(EBOOTFILE
, rc
);
170 kernel_entry
= (void*) loadbuffer
;