diff options
author | Barry Wardell <rockbox@barrywardell.net> | 2006-12-19 11:33:53 +0000 |
---|---|---|
committer | Barry Wardell <rockbox@barrywardell.net> | 2006-12-19 11:33:53 +0000 |
commit | 2f16d4f1b3e52f0a268fa9679a72694f5a89dedf (patch) | |
tree | 332b7b5390bcd95fea7b291ca840e709c7aa1f83 /bootloader/e200.c | |
parent | 6f4f58916417bdd11f2faf8339a0e94a039ca7a8 (diff) | |
download | rockbox-2f16d4f1b3e52f0a268fa9679a72694f5a89dedf.tar.gz rockbox-2f16d4f1b3e52f0a268fa9679a72694f5a89dedf.zip |
Add working dual-boot bootloaders for H10 and Sansa, which allow booting the OF and Rockbox. Rolo also works.
Changes made:
Combine bootloader/h10.c and bootloader/e200.c into a common bootloader file (bootloader/main-pp.c) to be used by all mi4 based PortalPlayer targets. The file bootloader/main-pp.c is based off the old bootloader/h10.c with some minor changes to allow it to work on the Sansa too. This effectively adds a Sansa bootloader.
Define MODEL_NAME string in config-*.h for use in bootloader.
Split crt0-pp.S into separate files for bootloader and normal builds. Bootloader code is now in crt0-pp-bl.S while normal build code stays in crt0-pp.S.
Improvements to crt0-pp.S and crt0-pp-bl.S (mostly to make it more multiprocessor safe):
* Leave space in bootloader at 0xe0-0xeb since scramble writes over there when it creates the mi4 file (don't leave space for iPods since it's not needed and all code in crt0-pp-bl.S needs to fit before the boot_table at 0x100).
* Remove unused DEBUG and STUB code from crt0-pp.S.
* Make CPU wait for COP to be sleeping when we put the COP to sleep.
* Invalidate COP cache when COP wakes
* Flush CPU cache before waking COP
* Make sure only the CPU clears the BSS (not the COP)
* Make sure only the CPU sets up its own stack (not the COP)
Rolo works on H10, so enable it.
Make Sansa e200 use rockbox.e200 rather than PP5022.mi4 for 'Normal' builds. This makes updating rockbox simpler as we don't need to go through the firmware update procedure, but rather just put a new rockbox.e200 on the device. rockbox.e200 uses a simple 'add' checksum.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11815 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader/e200.c')
-rw-r--r-- | bootloader/e200.c | 190 |
1 files changed, 0 insertions, 190 deletions
diff --git a/bootloader/e200.c b/bootloader/e200.c deleted file mode 100644 index 27b1118a1c..0000000000 --- a/bootloader/e200.c +++ /dev/null | |||
@@ -1,190 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 Daniel Stenberg | ||
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 | #include "config.h" | ||
20 | |||
21 | #include <stdlib.h> | ||
22 | #include <stdio.h> | ||
23 | #include <string.h> | ||
24 | #include "cpu.h" | ||
25 | #include "system.h" | ||
26 | #include "lcd.h" | ||
27 | #include "kernel.h" | ||
28 | #include "thread.h" | ||
29 | #include "ata.h" | ||
30 | #include "fat.h" | ||
31 | #include "disk.h" | ||
32 | #include "font.h" | ||
33 | #include "adc.h" | ||
34 | #include "backlight.h" | ||
35 | #include "panic.h" | ||
36 | #include "power.h" | ||
37 | #include "file.h" | ||
38 | |||
39 | static inline void blink(void) | ||
40 | { | ||
41 | volatile unsigned int* ptr; | ||
42 | int i; | ||
43 | ptr = (volatile unsigned int*)0x70000020; | ||
44 | |||
45 | *ptr &= ~(1 << 13); | ||
46 | for(i = 0; i < 0xfffff; i++) | ||
47 | { | ||
48 | } | ||
49 | *ptr |= (1 << 13); | ||
50 | for(i = 0; i < 0xfffff; i++) | ||
51 | { | ||
52 | } | ||
53 | } | ||
54 | |||
55 | static inline void slow_blink(void) | ||
56 | { | ||
57 | volatile unsigned int* ptr; | ||
58 | int i; | ||
59 | ptr = (volatile unsigned int*)0x70000020; | ||
60 | |||
61 | *ptr &= ~(1 << 13); | ||
62 | for(i = 0; i < (0xfffff); i++) | ||
63 | { | ||
64 | } | ||
65 | for(i = 0; i < (0xfffff); i++) | ||
66 | { | ||
67 | } | ||
68 | for(i = 0; i < (0xfffff); i++) | ||
69 | { | ||
70 | } | ||
71 | |||
72 | *ptr |= (1 << 13); | ||
73 | for(i = 0; i < (0xfffff); i++) | ||
74 | { | ||
75 | } | ||
76 | for(i = 0; i < (0xfffff); i++) | ||
77 | { | ||
78 | } | ||
79 | for(i = 0; i < (0xfffff); i++) | ||
80 | { | ||
81 | } | ||
82 | } | ||
83 | |||
84 | static inline unsigned long get_pc(void) | ||
85 | { | ||
86 | unsigned long pc; | ||
87 | asm volatile ( | ||
88 | "mov %0, pc\n" | ||
89 | : "=r"(pc) | ||
90 | ); | ||
91 | return pc; | ||
92 | } | ||
93 | |||
94 | /* These functions are present in the firmware library, but we reimplement | ||
95 | them here because the originals do a lot more than we want */ | ||
96 | |||
97 | void reset_poweroff_timer(void) | ||
98 | { | ||
99 | } | ||
100 | |||
101 | int dbg_ports(void) | ||
102 | { | ||
103 | unsigned int gpio_a, gpio_b, gpio_c, gpio_d; | ||
104 | unsigned int gpio_e, gpio_f, gpio_g, gpio_h; | ||
105 | unsigned int gpio_i, gpio_j, gpio_k, gpio_l; | ||
106 | |||
107 | char buf[128]; | ||
108 | int line; | ||
109 | |||
110 | lcd_setmargins(0, 0); | ||
111 | lcd_clear_display(); | ||
112 | lcd_setfont(FONT_SYSFIXED); | ||
113 | |||
114 | while(1) | ||
115 | { | ||
116 | gpio_a = GPIOA_INPUT_VAL; | ||
117 | gpio_b = GPIOB_INPUT_VAL; | ||
118 | gpio_c = GPIOC_INPUT_VAL; | ||
119 | |||
120 | gpio_g = GPIOG_INPUT_VAL; | ||
121 | gpio_h = GPIOH_INPUT_VAL; | ||
122 | gpio_i = GPIOI_INPUT_VAL; | ||
123 | |||
124 | line = 0; | ||
125 | snprintf(buf, sizeof(buf), "GPIO_A: %02x GPIO_G: %02x", gpio_a, gpio_g); | ||
126 | lcd_puts(0, line++, buf); | ||
127 | snprintf(buf, sizeof(buf), "GPIO_B: %02x GPIO_H: %02x", gpio_b, gpio_h); | ||
128 | lcd_puts(0, line++, buf); | ||
129 | snprintf(buf, sizeof(buf), "GPIO_C: %02x GPIO_I: %02x", gpio_c, gpio_i); | ||
130 | lcd_puts(0, line++, buf); | ||
131 | line++; | ||
132 | |||
133 | gpio_d = GPIOD_INPUT_VAL; | ||
134 | gpio_e = GPIOE_INPUT_VAL; | ||
135 | gpio_f = GPIOF_INPUT_VAL; | ||
136 | |||
137 | gpio_j = GPIOJ_INPUT_VAL; | ||
138 | gpio_k = GPIOK_INPUT_VAL; | ||
139 | gpio_l = GPIOL_INPUT_VAL; | ||
140 | |||
141 | snprintf(buf, sizeof(buf), "GPIO_D: %02x GPIO_J: %02x", gpio_d, gpio_j); | ||
142 | lcd_puts(0, line++, buf); | ||
143 | snprintf(buf, sizeof(buf), "GPIO_E: %02x GPIO_K: %02x", gpio_e, gpio_k); | ||
144 | lcd_puts(0, line++, buf); | ||
145 | snprintf(buf, sizeof(buf), "GPIO_F: %02x GPIO_L: %02x", gpio_f, gpio_l); | ||
146 | lcd_puts(0, line++, buf); | ||
147 | line++; | ||
148 | snprintf(buf, sizeof(buf), "ADC_1: %02x", adc_read(ADC_0)); | ||
149 | lcd_puts(0, line++, buf); | ||
150 | snprintf(buf, sizeof(buf), "ADC_2: %02x", adc_read(ADC_1)); | ||
151 | lcd_puts(0, line++, buf); | ||
152 | snprintf(buf, sizeof(buf), "ADC_3: %02x", adc_read(ADC_2)); | ||
153 | lcd_puts(0, line++, buf); | ||
154 | snprintf(buf, sizeof(buf), "ADC_4: %02x", adc_read(ADC_3)); | ||
155 | lcd_puts(0, line++, buf); | ||
156 | lcd_update(); | ||
157 | } | ||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | void mpeg_stop(void) | ||
162 | { | ||
163 | } | ||
164 | |||
165 | void usb_acknowledge(void) | ||
166 | { | ||
167 | } | ||
168 | |||
169 | void usb_wait_for_disconnect(void) | ||
170 | { | ||
171 | } | ||
172 | |||
173 | void sys_poweroff(void) | ||
174 | { | ||
175 | } | ||
176 | |||
177 | void system_reboot(void) | ||
178 | { | ||
179 | |||
180 | } | ||
181 | |||
182 | void main(void) | ||
183 | { | ||
184 | kernel_init(); | ||
185 | adc_init(); | ||
186 | lcd_init_device(); | ||
187 | |||
188 | dbg_ports(); | ||
189 | } | ||
190 | |||