diff options
Diffstat (limited to 'bootloader')
-rw-r--r-- | bootloader/SOURCES | 1 | ||||
-rw-r--r-- | bootloader/common.c | 3 | ||||
-rwxr-xr-x | bootloader/ondavx747.c | 73 |
3 files changed, 67 insertions, 10 deletions
diff --git a/bootloader/SOURCES b/bootloader/SOURCES index d36479c4ee..42f3f577cf 100644 --- a/bootloader/SOURCES +++ b/bootloader/SOURCES | |||
@@ -44,6 +44,7 @@ meizu_m6sp.c | |||
44 | meizu_m3.c | 44 | meizu_m3.c |
45 | #elif defined(ONDA_VX747) || defined(ONDA_VX747P) || defined(ONDA_VX767) || defined(ONDA_VX777) | 45 | #elif defined(ONDA_VX747) || defined(ONDA_VX747P) || defined(ONDA_VX767) || defined(ONDA_VX777) |
46 | ondavx747.c | 46 | ondavx747.c |
47 | show_logo.c | ||
47 | #elif defined(CREATIVE_ZVx) | 48 | #elif defined(CREATIVE_ZVx) |
48 | creativezvm.c | 49 | creativezvm.c |
49 | #elif CONFIG_CPU==AS3525 | 50 | #elif CONFIG_CPU==AS3525 |
diff --git a/bootloader/common.c b/bootloader/common.c index 4ac421d872..f7ab661ca2 100644 --- a/bootloader/common.c +++ b/bootloader/common.c | |||
@@ -40,7 +40,8 @@ | |||
40 | #if defined(IPOD_ARCH) || defined(IRIVER_H10) || defined(IRIVER_H10_5GB) \ | 40 | #if defined(IPOD_ARCH) || defined(IRIVER_H10) || defined(IRIVER_H10_5GB) \ |
41 | || defined(SANSA_E200) || defined(SANSA_C200) || defined(GIGABEAT_F) \ | 41 | || defined(SANSA_E200) || defined(SANSA_C200) || defined(GIGABEAT_F) \ |
42 | || defined(PHILIPS_SA9200) || (CONFIG_CPU == AS3525) || defined(COWON_D2) \ | 42 | || defined(PHILIPS_SA9200) || (CONFIG_CPU == AS3525) || defined(COWON_D2) \ |
43 | || defined(MROBE_100) || defined(PHILIPS_HDD1630) || defined(MROBE_500) | 43 | || defined(MROBE_100) || defined(PHILIPS_HDD1630) || defined(MROBE_500) \ |
44 | || defined(ONDA_VX747) | ||
44 | bool verbose = false; | 45 | bool verbose = false; |
45 | #else | 46 | #else |
46 | bool verbose = true; | 47 | bool verbose = true; |
diff --git a/bootloader/ondavx747.c b/bootloader/ondavx747.c index 6a04c1ba85..3767005ebe 100755 --- a/bootloader/ondavx747.c +++ b/bootloader/ondavx747.c | |||
@@ -34,6 +34,8 @@ | |||
34 | #include "string.h" | 34 | #include "string.h" |
35 | #include "adc.h" | 35 | #include "adc.h" |
36 | 36 | ||
37 | extern int show_logo(void); | ||
38 | |||
37 | static void show_splash(int timeout, const char *msg) | 39 | static void show_splash(int timeout, const char *msg) |
38 | { | 40 | { |
39 | reset_screen(); | 41 | reset_screen(); |
@@ -84,9 +86,52 @@ static void usb_mode(void) | |||
84 | reset_screen(); | 86 | reset_screen(); |
85 | } | 87 | } |
86 | 88 | ||
87 | static void boot_of(void) | 89 | static int boot_of(void) |
88 | { | 90 | { |
89 | /* Do nothing atm */ | 91 | int fd, rc, len, i, checksum = 0; |
92 | void (*kernel_entry)(int, void*, void*); | ||
93 | |||
94 | /* TODO: get this from the NAND flash instead of SD */ | ||
95 | fd = open("/ccpmp.bin", O_RDONLY); | ||
96 | if(fd < 0) | ||
97 | return EFILE_NOT_FOUND; | ||
98 | |||
99 | lseek(fd, 4, SEEK_SET); | ||
100 | rc = read(fd, (char*)&len, 4); /* CPU is LE */ | ||
101 | if(rc < 4) | ||
102 | return EREAD_IMAGE_FAILED; | ||
103 | |||
104 | len += 8; | ||
105 | printf("Reading %d bytes...", len); | ||
106 | |||
107 | lseek(fd, 0, SEEK_SET); | ||
108 | rc = read(fd, (void*)0x80004000, len); | ||
109 | if(rc < len) | ||
110 | return EREAD_IMAGE_FAILED; | ||
111 | |||
112 | close(fd); | ||
113 | |||
114 | for(i=0; i<len; i++) | ||
115 | checksum += ((unsigned char*)0x80004000)[i]; | ||
116 | |||
117 | *((unsigned int*)0x80004000) = checksum; | ||
118 | |||
119 | printf("Starting the OF..."); | ||
120 | |||
121 | /* OF requires all clocks on */ | ||
122 | __cpm_start_all(); | ||
123 | |||
124 | disable_interrupt(); | ||
125 | __dcache_writeback_all(); | ||
126 | __icache_invalidate_all(); | ||
127 | |||
128 | for(i=8000; i>0; i--) | ||
129 | asm volatile("nop\n"); | ||
130 | |||
131 | kernel_entry = (void*) 0x80004008; | ||
132 | kernel_entry(0, "Jan 10 2008", "15:34:42"); /* Reversed from the SPL */ | ||
133 | |||
134 | return 0; | ||
90 | } | 135 | } |
91 | 136 | ||
92 | int main(void) | 137 | int main(void) |
@@ -102,12 +147,9 @@ int main(void) | |||
102 | font_init(); | 147 | font_init(); |
103 | lcd_setfont(FONT_SYSFIXED); | 148 | lcd_setfont(FONT_SYSFIXED); |
104 | button_init(); | 149 | button_init(); |
105 | adc_init(); | ||
106 | backlight_init(); | 150 | backlight_init(); |
107 | 151 | ||
108 | reset_screen(); | 152 | show_logo(); |
109 | printf(MODEL_NAME" Rockbox Bootloader"); | ||
110 | printf("Version "APPSVERSION); | ||
111 | 153 | ||
112 | rc = storage_init(); | 154 | rc = storage_init(); |
113 | if(rc) | 155 | if(rc) |
@@ -119,15 +161,28 @@ int main(void) | |||
119 | rc = button_read_device(); | 161 | rc = button_read_device(); |
120 | #endif | 162 | #endif |
121 | 163 | ||
164 | if(rc) | ||
165 | verbose = true; | ||
166 | |||
122 | if(rc & BUTTON_VOL_UP) | 167 | if(rc & BUTTON_VOL_UP) |
123 | usb_mode(); | 168 | usb_mode(); |
124 | else if(button_hold()) | 169 | |
125 | boot_of(); | 170 | if(verbose) |
171 | reset_screen(); | ||
172 | printf(MODEL_NAME" Rockbox Bootloader"); | ||
173 | printf("Version "APPSVERSION); | ||
126 | 174 | ||
127 | rc = disk_mount_all(); | 175 | rc = disk_mount_all(); |
128 | if (rc <= 0) | 176 | if (rc <= 0) |
129 | error(EDISK,rc); | 177 | error(EDISK,rc); |
130 | 178 | ||
179 | if(button_hold()) | ||
180 | { | ||
181 | rc = boot_of(); | ||
182 | if(rc < 0) | ||
183 | printf("Error: %s", strerror(rc)); | ||
184 | } | ||
185 | |||
131 | printf("Loading firmware"); | 186 | printf("Loading firmware"); |
132 | rc = load_firmware((unsigned char *)CONFIG_SDRAM_START, BOOTFILE, 0x400000); | 187 | rc = load_firmware((unsigned char *)CONFIG_SDRAM_START, BOOTFILE, 0x400000); |
133 | if(rc < 0) | 188 | if(rc < 0) |
@@ -136,7 +191,7 @@ int main(void) | |||
136 | if (rc == EOK) | 191 | if (rc == EOK) |
137 | { | 192 | { |
138 | printf("Starting Rockbox..."); | 193 | printf("Starting Rockbox..."); |
139 | adc_close(); /* Disable SADC */ | 194 | adc_close(); /* Disable SADC */ |
140 | _backlight_off(); /* Force backlight off to prevent LCD 'flicker' */ | 195 | _backlight_off(); /* Force backlight off to prevent LCD 'flicker' */ |
141 | 196 | ||
142 | disable_interrupt(); | 197 | disable_interrupt(); |