Skip to content
Newer
Older
100644 121 lines (103 sloc) 3.01 KB
fdd71df * Commit dual-boot support for Creative ZVx family
mcuelenaere authored Aug 27, 2008
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Maurus Cuelenaere
11 *
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.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20 #include "system.h"
21 #include "lcd.h"
22 #include "kernel.h"
23 #include "thread.h"
655d642 Apply FS#9500. This adds a storage_*() abstraction to replace ata_*()…
gevaerts authored Nov 1, 2008
24 #include "storage.h"
fdd71df * Commit dual-boot support for Creative ZVx family
mcuelenaere authored Aug 27, 2008
25 #include "ata-target.h"
26 #include "disk.h"
27 #include "font.h"
28 #include "backlight.h"
29 #include "button.h"
30 #include "common.h"
f1fad61 Creative ZVM:
mcuelenaere authored Feb 5, 2009
31 #include "usb.h"
fdd71df * Commit dual-boot support for Creative ZVx family
mcuelenaere authored Aug 27, 2008
32
33
34 static void load_fw(unsigned char* ptr, unsigned int len)
35 {
36 (void)ptr;
37 (void)len;
38 asm volatile("ldr pc, =0x1EE0000");
39 }
40
41 void main(void)
42 {
43 unsigned char* loadbuffer;
44 int buffer_size;
45 int(*kernel_entry)(void);
46 int ret;
47
bd710d5 Fix TABing
mcuelenaere authored Aug 27, 2008
48 /* Make sure interrupts are disabled */
49 set_irq_level(IRQ_DISABLED);
fdd71df * Commit dual-boot support for Creative ZVx family
mcuelenaere authored Aug 27, 2008
50 set_fiq_status(FIQ_DISABLED);
51 system_init();
52 kernel_init();
bd710d5 Fix TABing
mcuelenaere authored Aug 27, 2008
53
54 /* Now enable interrupts */
55 set_irq_level(IRQ_ENABLED);
fdd71df * Commit dual-boot support for Creative ZVx family
mcuelenaere authored Aug 27, 2008
56 set_fiq_status(FIQ_ENABLED);
57 backlight_init();
58 lcd_init();
59 font_init();
60 button_init();
f1fad61 Creative ZVM:
mcuelenaere authored Feb 5, 2009
61 usb_init();
fdd71df * Commit dual-boot support for Creative ZVx family
mcuelenaere authored Aug 27, 2008
62
0de1b13 Fix ZVM 30GB bootloader.
kugel authored Mar 17, 2009
63 #ifdef HAVE_LCD_ENABLE
fdd71df * Commit dual-boot support for Creative ZVx family
mcuelenaere authored Aug 27, 2008
64 lcd_enable(true);
0de1b13 Fix ZVM 30GB bootloader.
kugel authored Mar 17, 2009
65 #endif
fdd71df * Commit dual-boot support for Creative ZVx family
mcuelenaere authored Aug 27, 2008
66 lcd_setfont(FONT_SYSFIXED);
67 reset_screen();
68 printf("Rockbox boot loader");
69 printf("Version %s", APPSVERSION);
70
655d642 Apply FS#9500. This adds a storage_*() abstraction to replace ata_*()…
gevaerts authored Nov 1, 2008
71 ret = storage_init();
bd710d5 Fix TABing
mcuelenaere authored Aug 27, 2008
72 if(ret)
73 printf("ATA error: %d", ret);
f1fad61 Creative ZVM:
mcuelenaere authored Feb 5, 2009
74
711dffe ZVM:
mcuelenaere authored Sep 7, 2008
75 /* If no button is held, start the OF */
76 if(button_read_device() == 0)
fdd71df * Commit dual-boot support for Creative ZVx family
mcuelenaere authored Aug 27, 2008
77 {
78 printf("Loading Creative firmware...");
79
80 loadbuffer = (unsigned char*)0x00A00000;
81 ret = load_minifs_file("creativeos.jrm", loadbuffer);
82 if(ret != -1)
83 {
bd710d5 Fix TABing
mcuelenaere authored Aug 27, 2008
84 set_irq_level(IRQ_DISABLED);
fdd71df * Commit dual-boot support for Creative ZVx family
mcuelenaere authored Aug 27, 2008
85 set_fiq_status(FIQ_DISABLED);
86 /* Doesn't return! */
87 load_fw(loadbuffer, ret);
88 }
89 else
90 printf("FAILED!");
91 }
92 else
93 {
94 disk_init();
95
96 ret = disk_mount_all();
97 if (ret <= 0)
98 error(EDISK, ret);
99
100 printf("Loading Rockbox firmware...");
101
102 loadbuffer = (unsigned char*)0x00900000;
103 buffer_size = (unsigned char*)0x01900000 - loadbuffer;
104
105 ret = load_firmware(loadbuffer, BOOTFILE, buffer_size);
106 if(ret < 0)
107 error(EBOOTFILE, ret);
108
109 else if(ret == EOK)
110 {
111 kernel_entry = (void*) loadbuffer;
112 ret = kernel_entry();
113 printf("FAILED!");
114 }
115 }
116
f1fad61 Creative ZVM:
mcuelenaere authored Feb 5, 2009
117 storage_sleepnow();
118
fdd71df * Commit dual-boot support for Creative ZVx family
mcuelenaere authored Aug 27, 2008
119 while(1);
120 }
Something went wrong with that request. Please try again.