summaryrefslogtreecommitdiff
path: root/bootloader/mrobe500.c
diff options
context:
space:
mode:
Diffstat (limited to 'bootloader/mrobe500.c')
-rwxr-xr-xbootloader/mrobe500.c135
1 files changed, 135 insertions, 0 deletions
diff --git a/bootloader/mrobe500.c b/bootloader/mrobe500.c
new file mode 100755
index 0000000000..02726dde5a
--- /dev/null
+++ b/bootloader/mrobe500.c
@@ -0,0 +1,135 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: $
9 *
10 * Copyright (C) 2007 by Karl Kurbjun
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 "inttypes.h"
21#include "string.h"
22#include "cpu.h"
23#include "system.h"
24#include "lcd.h"
25#include "kernel.h"
26#include "thread.h"
27#include "ata.h"
28#include "fat.h"
29#include "disk.h"
30#include "font.h"
31#include "adc.h"
32#include "backlight.h"
33#include "backlight-target.h"
34#include "button.h"
35#include "panic.h"
36#include "power.h"
37#include "file.h"
38#include "common.h"
39#include "rbunicode.h"
40#include "usb.h"
41
42void main(void)
43{
44 unsigned char* loadbuffer;
45 int buffer_size;
46 int rc;
47 int(*kernel_entry)(void);
48
49 power_init();
50 system_init();
51 kernel_init();
52 adc_init();
53 button_init();
54 backlight_init();
55
56 lcd_init();
57 font_init();
58
59 lcd_setfont(FONT_SYSFIXED);
60
61 /* Show debug messages if button is pressed */
62// if(button_read_device())
63 verbose = true;
64
65 printf("Rockbox boot loader");
66 printf("Version %s", APPSVERSION);
67
68 usb_init();
69
70 #if 0
71 /* Enter USB mode without USB thread */
72 if(usb_detect())
73 {
74 const char msg[] = "Bootloader USB mode";
75 reset_screen();
76 lcd_putsxy( (LCD_WIDTH - (SYSFONT_WIDTH * strlen(msg))) / 2,
77 (LCD_HEIGHT - SYSFONT_HEIGHT) / 2, msg);
78 lcd_update();
79
80 ide_power_enable(true);
81 ata_enable(false);
82 sleep(HZ/20);
83 usb_enable(true);
84
85 while (usb_detect())
86 {
87 ata_spin(); /* Prevent the drive from spinning down */
88 sleep(HZ);
89 }
90
91 usb_enable(false);
92
93 reset_screen();
94 lcd_update();
95 }
96 #endif
97
98 printf("ATA");
99 while(true)
100 {
101 }
102#if 0
103 rc = ata_init();
104 if(rc)
105 {
106 reset_screen();
107 error(EATA, rc);
108 }
109
110 printf("disk");
111 disk_init();
112
113 printf("mount");
114 rc = disk_mount_all();
115 if (rc<=0)
116 {
117 error(EDISK,rc);
118 }
119
120 printf("Loading firmware");
121
122 loadbuffer = (unsigned char*) 0x00900000;
123 buffer_size = (unsigned char*)0x00100000 - loadbuffer;
124
125 rc = load_firmware(loadbuffer, BOOTFILE, buffer_size);
126 if(rc < 0)
127 error(EBOOTFILE, rc);
128
129 if (rc == EOK)
130 {
131 kernel_entry = (void*) loadbuffer;
132 rc = kernel_entry();
133 }
134#endif
135}