summaryrefslogtreecommitdiff
path: root/bootloader/main.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-07-08 15:09:44 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-07-08 15:09:44 +0000
commite82df4e5970fbf970f471db81df56cc55d977a7c (patch)
tree68282ce5dcaa0a2a9060835baa1e643883796693 /bootloader/main.c
parent2d251224313a42efbbd5b7cde5ccc9245138fbc4 (diff)
downloadrockbox-e82df4e5970fbf970f471db81df56cc55d977a7c.tar.gz
rockbox-e82df4e5970fbf970f471db81df56cc55d977a7c.zip
Bootloader adjustments for H110
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7072 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader/main.c')
-rw-r--r--bootloader/main.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/bootloader/main.c b/bootloader/main.c
index 208d5cf662..736b0a6f5f 100644
--- a/bootloader/main.c
+++ b/bootloader/main.c
@@ -35,6 +35,14 @@
35#include "power.h" 35#include "power.h"
36#include "file.h" 36#include "file.h"
37 37
38#ifdef IRIVER_H100
39#define MODEL_NUMBER 1
40#define DRAM_START 0x30000000
41#else
42#define MODEL_NUMBER 0
43#define DRAM_START 0x31000000
44#endif
45
38int line = 0; 46int line = 0;
39 47
40int usb_screen(void) 48int usb_screen(void)
@@ -88,7 +96,7 @@ int load_firmware(void)
88 unsigned long chksum; 96 unsigned long chksum;
89 unsigned long sum; 97 unsigned long sum;
90 int i; 98 int i;
91 unsigned char *buf = (unsigned char *)0x31000000; 99 unsigned char *buf = (unsigned char *)DRAM_START;
92 char str[80]; 100 char str[80];
93 101
94 fd = open("/rockbox.iriver", O_RDONLY); 102 fd = open("/rockbox.iriver", O_RDONLY);
@@ -119,7 +127,7 @@ int load_firmware(void)
119 127
120 close(fd); 128 close(fd);
121 129
122 sum = 0; 130 sum = MODEL_NUMBER;
123 131
124 for(i = 0;i < len;i++) { 132 for(i = 0;i < len;i++) {
125 sum += buf[i]; 133 sum += buf[i];
@@ -135,16 +143,17 @@ int load_firmware(void)
135 return 0; 143 return 0;
136} 144}
137 145
146
138void start_firmware(void) 147void start_firmware(void)
139{ 148{
140 asm(" move.w #0x2700,%sr"); 149 asm(" move.w #0x2700,%sr");
141 /* Reset the cookie for the crt0 crash check */ 150 /* Reset the cookie for the crt0 crash check */
142 asm(" move.l #0,%d0"); 151 asm(" move.l #0,%d0");
143 asm(" move.l %d0,0x10017ffc"); 152 asm(" move.l %d0,0x10017ffc");
144 asm(" move.l #0x31000000,%d0"); 153 asm(" move.l %0,%%d0" :: "i"(DRAM_START));
145 asm(" movec.l %d0,%vbr"); 154 asm(" movec.l %d0,%vbr");
146 asm(" move.l 0x31000000,%sp"); 155 asm(" move.l %0,%%sp" :: "m"(*(int *)DRAM_START));
147 asm(" move.l 0x31000004,%a0"); 156 asm(" move.l %0,%%a0" :: "m"(*(int *)(DRAM_START+4)));
148 asm(" jmp (%a0)"); 157 asm(" jmp (%a0)");
149} 158}
150 159