summaryrefslogtreecommitdiffstats
path: root/bootloader
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2008-11-09 06:17:21 +0000
committerRafaël Carré <rafael.carre@gmail.com>2008-11-09 06:17:21 +0000
commitaef27e1f0c69516bbcf13d7986e204502d708ec4 (patch)
tree127bc7a9a71e8856247a6ea52805c1666a92c26c /bootloader
parent308f21dc68ca1387c7003e9d185b717af7d575bf (diff)
downloadrockbox-aef27e1f0c69516bbcf13d7986e204502d708ec4.tar.gz
rockbox-aef27e1f0c69516bbcf13d7986e204502d708ec4.tar.bz2
rockbox-aef27e1f0c69516bbcf13d7986e204502d708ec4.zip
Sansav2 Bootloader
Adds read-only SD driver, largely copied from ata-sd-pp.c Only tested on the embedded SD, on the Clip First steps to build a Normal firmware git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19045 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader')
-rw-r--r--bootloader/sansa_as3525.c66
1 files changed, 47 insertions, 19 deletions
diff --git a/bootloader/sansa_as3525.c b/bootloader/sansa_as3525.c
index 6340fbbc41..1385e47ff6 100644
--- a/bootloader/sansa_as3525.c
+++ b/bootloader/sansa_as3525.c
@@ -31,43 +31,71 @@
#include "as3525-codec.h"
#include "common.h"
#include "storage.h"
+#include "disk.h"
+#include "panic.h"
int show_logo(void);
void main(void)
{
- int i;
- unsigned char buf[8];
+ unsigned char* loadbuffer;
+ int buffer_size;
+ void(*kernel_entry)(void);
+ int ret;
+ int delay;
system_init();
kernel_init();
lcd_init();
-
show_logo();
as3525_codec_init(); /* Required for backlight on e200v2 */
-
_backlight_on();
- /* show player id to demonstrate communication with codec part */
- for (i = 0; i < 8; i++) {
- buf[i] = as3525_codec_read(0x38 + i);
- }
- printf("ID: %02X%02X%02X%02X%02X%02X%02X%02X", buf[7], buf[6], buf[5], buf[4], buf[3], buf[2], buf[1], buf[0]);
+ delay = 0x3000000;
+ while(delay--); /* show splash screen */
+ reset_screen();
+
+ asm volatile(
+ "mrs r0, cpsr \n"
+ "bic r0, r0, #0x80 \n" /* enable interrupts */
+ "msr cpsr, r0 \n"
+ : : : "r0" );
+
+ ret = storage_init();
+ if(ret < 0)
+ error(EATA,ret);
- storage_init();
+ if(!disk_init(IF_MV(0)))
+ panicf("disk_init failed!");
-#ifdef SANSA_CLIP
- /* Use hardware scrolling */
+ ret = disk_mount_all();
- lcd_write_command(0x26); /* scroll setup */
- lcd_write_command(0x01); /* columns scrolled per step */
- lcd_write_command(0x00); /* start page */
- lcd_write_command(0x00); /* steps freqency */
- lcd_write_command(0x07); /* end page (including) */
+ if(ret <= 0)
+ error(EDISK, ret);
- lcd_write_command(0x2F); /* start horizontal scrolling */
-#endif
+ printf("Loading firmware");
+
+ loadbuffer = (unsigned char*)0x30000000; /* DRAM */
+ buffer_size = (int)(loadbuffer + (MEM * 0x100000));
+
+ ret = load_firmware(loadbuffer, BOOTFILE, buffer_size);
+ if(ret < 0)
+ error(EBOOTFILE, ret);
+
+ asm volatile(
+ "mrs r0, cpsr \n"
+ "orr r0, r0, #0x80 \n" /* disable interrupts */
+ "msr cpsr, r0 \n"
+ : : : "r0" );
+
+ if (ret == EOK)
+ {
+ kernel_entry = (void*) loadbuffer;
+ printf("Executing");
+ kernel_entry();
+ printf("ERR: Failed to boot");
+ }
/* never returns */
while(1) ;