diff options
-rw-r--r-- | apps/debug_menu.c | 43 | ||||
-rw-r--r-- | apps/main.c | 6 | ||||
-rw-r--r-- | bootloader/common.c | 2 | ||||
-rw-r--r-- | bootloader/gigabeat.c | 278 | ||||
-rw-r--r-- | firmware/export/config-gigabeat.h | 2 | ||||
-rw-r--r-- | firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c | 4 | ||||
-rw-r--r-- | firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c | 17 | ||||
-rw-r--r-- | firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.c | 17 | ||||
-rw-r--r-- | firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.h | 2 | ||||
-rw-r--r-- | firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/s3c2440/gigabeat-fx/usb-meg-fx.c | 2 | ||||
-rwxr-xr-x | tools/configure | 2 | ||||
-rw-r--r-- | tools/scramble.c | 2 |
13 files changed, 150 insertions, 229 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 12d5f435b7..9f827e7b7b 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -88,6 +88,10 @@ | |||
88 | #endif | 88 | #endif |
89 | #include "hwcompat.h" | 89 | #include "hwcompat.h" |
90 | 90 | ||
91 | #if CONFIG_CPU == S3C2440 | ||
92 | #include "s3c2440.h" | ||
93 | #endif | ||
94 | |||
91 | #ifndef SIMULATOR | 95 | #ifndef SIMULATOR |
92 | static bool dbg_list(char *title, int count, int selection_size, | 96 | static bool dbg_list(char *title, int count, int selection_size, |
93 | int (*action_callback)(int btn, struct gui_synclist *lists), | 97 | int (*action_callback)(int btn, struct gui_synclist *lists), |
@@ -1133,6 +1137,43 @@ bool dbg_ports(void) | |||
1133 | if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) | 1137 | if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) |
1134 | return false; | 1138 | return false; |
1135 | } | 1139 | } |
1140 | #elif CONFIG_CPU == S3C2440 | ||
1141 | char buf[128]; | ||
1142 | int line, fd; | ||
1143 | |||
1144 | lcd_setmargins(0, 0); | ||
1145 | lcd_clear_display(); | ||
1146 | lcd_setfont(FONT_SYSFIXED); | ||
1147 | |||
1148 | while(1) | ||
1149 | { | ||
1150 | line = 0; | ||
1151 | snprintf(buf, sizeof(buf), "GPACON: %08x GPBCON: %08x", GPACON, GPBCON); lcd_puts(0, line++, buf); | ||
1152 | snprintf(buf, sizeof(buf), "GPADAT: %08x GPBDAT: %08x", GPADAT, GPBDAT); lcd_puts(0, line++, buf); | ||
1153 | snprintf(buf, sizeof(buf), "GPAUP: %08x GPBUP: %08x", 0, GPBUP); lcd_puts(0, line++, buf); | ||
1154 | snprintf(buf, sizeof(buf), "GPCCON: %08x GPDCON: %08x", GPCCON, GPDCON); lcd_puts(0, line++, buf); | ||
1155 | snprintf(buf, sizeof(buf), "GPCDAT: %08x GPDDAT: %08x", GPCDAT, GPDDAT); lcd_puts(0, line++, buf); | ||
1156 | snprintf(buf, sizeof(buf), "GPCUP: %08x GPDUP: %08x", GPCUP, GPDUP); lcd_puts(0, line++, buf); | ||
1157 | |||
1158 | snprintf(buf, sizeof(buf), "GPCCON: %08x GPDCON: %08x", GPCCON, GPDCON); lcd_puts(0, line++, buf); | ||
1159 | snprintf(buf, sizeof(buf), "GPCDAT: %08x GPDDAT: %08x", GPCDAT, GPDDAT); lcd_puts(0, line++, buf); | ||
1160 | snprintf(buf, sizeof(buf), "GPCUP: %08x GPDUP: %08x", GPCUP, GPDUP); lcd_puts(0, line++, buf); | ||
1161 | |||
1162 | snprintf(buf, sizeof(buf), "GPECON: %08x GPFCON: %08x", GPECON, GPFCON); lcd_puts(0, line++, buf); | ||
1163 | snprintf(buf, sizeof(buf), "GPEDAT: %08x GPFDAT: %08x", GPEDAT, GPFDAT); lcd_puts(0, line++, buf); | ||
1164 | snprintf(buf, sizeof(buf), "GPEUP: %08x GPFUP: %08x", GPEUP, GPFUP); lcd_puts(0, line++, buf); | ||
1165 | |||
1166 | snprintf(buf, sizeof(buf), "GPGCON: %08x GPHCON: %08x", GPGCON, GPHCON); lcd_puts(0, line++, buf); | ||
1167 | snprintf(buf, sizeof(buf), "GPGDAT: %08x GPHDAT: %08x", GPGDAT, GPHDAT); lcd_puts(0, line++, buf); | ||
1168 | snprintf(buf, sizeof(buf), "GPGUP: %08x GPHUP: %08x", GPGUP, GPHUP); lcd_puts(0, line++, buf); | ||
1169 | |||
1170 | snprintf(buf, sizeof(buf), "GPJCON: %08x", GPJCON); lcd_puts(0, line++, buf); | ||
1171 | snprintf(buf, sizeof(buf), "GPJDAT: %08x", GPJDAT); lcd_puts(0, line++, buf); | ||
1172 | snprintf(buf, sizeof(buf), "GPJUP: %08x", GPJUP); lcd_puts(0, line++, buf); | ||
1173 | lcd_update(); | ||
1174 | if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) | ||
1175 | return false; | ||
1176 | } | ||
1136 | #endif /* CPU */ | 1177 | #endif /* CPU */ |
1137 | return false; | 1178 | return false; |
1138 | } | 1179 | } |
@@ -2271,7 +2312,7 @@ bool debug_menu(void) | |||
2271 | (defined(CPU_PP) && !defined(SANSA_E200)) | 2312 | (defined(CPU_PP) && !defined(SANSA_E200)) |
2272 | { "Dump ROM contents", dbg_save_roms }, | 2313 | { "Dump ROM contents", dbg_save_roms }, |
2273 | #endif | 2314 | #endif |
2274 | #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || defined(CPU_PP) | 2315 | #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || defined(CPU_PP) || CONFIG_CPU == S3C2440 |
2275 | { "View I/O ports", dbg_ports }, | 2316 | { "View I/O ports", dbg_ports }, |
2276 | #endif | 2317 | #endif |
2277 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 2318 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
diff --git a/apps/main.c b/apps/main.c index ab7f9f39b4..31bf32c714 100644 --- a/apps/main.c +++ b/apps/main.c | |||
@@ -336,12 +336,8 @@ static void init(void) | |||
336 | lcd_remote_init(); | 336 | lcd_remote_init(); |
337 | #endif | 337 | #endif |
338 | font_init(); | 338 | font_init(); |
339 | 339 | ||
340 | #if !defined(TOSHIBA_GIGABEAT_F) || defined(SIMULATOR) | ||
341 | show_logo(); | 340 | show_logo(); |
342 | #else | ||
343 | sleep(1); /* Weird. We crash w/o this tiny delay. */ | ||
344 | #endif | ||
345 | lang_init(); | 341 | lang_init(); |
346 | 342 | ||
347 | #ifdef DEBUG | 343 | #ifdef DEBUG |
diff --git a/bootloader/common.c b/bootloader/common.c index 51b751cbf9..1ac8e8f7e3 100644 --- a/bootloader/common.c +++ b/bootloader/common.c | |||
@@ -31,7 +31,7 @@ | |||
31 | /* TODO: Other bootloaders need to be adjusted to set this variable to true | 31 | /* TODO: Other bootloaders need to be adjusted to set this variable to true |
32 | on a button press - currently only the ipod, H10 and Sansa versions do. */ | 32 | on a button press - currently only the ipod, H10 and Sansa versions do. */ |
33 | #if defined(IPOD_ARCH) || defined(IRIVER_H10) || defined(IRIVER_H10_5GB) || \ | 33 | #if defined(IPOD_ARCH) || defined(IRIVER_H10) || defined(IRIVER_H10_5GB) || \ |
34 | defined(SANSA_E200) | 34 | defined(SANSA_E200) || defined(GIGABEAT_F) |
35 | bool verbose = false; | 35 | bool verbose = false; |
36 | #else | 36 | #else |
37 | bool verbose = true; | 37 | bool verbose = true; |
diff --git a/bootloader/gigabeat.c b/bootloader/gigabeat.c index e4cf6f08fd..e482c70d16 100644 --- a/bootloader/gigabeat.c +++ b/bootloader/gigabeat.c | |||
@@ -20,7 +20,8 @@ | |||
20 | 20 | ||
21 | #include <stdlib.h> | 21 | #include <stdlib.h> |
22 | #include <stdio.h> | 22 | #include <stdio.h> |
23 | #include <string.h> | 23 | #include "inttypes.h" |
24 | #include "string.h" | ||
24 | #include "cpu.h" | 25 | #include "cpu.h" |
25 | #include "system.h" | 26 | #include "system.h" |
26 | #include "lcd.h" | 27 | #include "lcd.h" |
@@ -32,250 +33,99 @@ | |||
32 | #include "font.h" | 33 | #include "font.h" |
33 | #include "adc.h" | 34 | #include "adc.h" |
34 | #include "backlight.h" | 35 | #include "backlight.h" |
36 | #include "backlight-target.h" | ||
37 | #include "button.h" | ||
35 | #include "panic.h" | 38 | #include "panic.h" |
36 | #include "power.h" | 39 | #include "power.h" |
37 | #include "file.h" | 40 | #include "file.h" |
38 | #include "button-target.h" | ||
39 | #include "common.h" | 41 | #include "common.h" |
42 | #include "rbunicode.h" | ||
43 | #include "usb.h" | ||
44 | #include "mmu-meg-fx.h" | ||
40 | 45 | ||
41 | extern void map_memory(void); | 46 | #include <stdarg.h> |
42 | 47 | ||
43 | char version[] = APPSVERSION; | 48 | char version[] = APPSVERSION; |
44 | 49 | ||
45 | static void go_usb_mode(void) | 50 | void main(void) |
46 | { | 51 | { |
47 | /* Drop into USB mode. This does not check for disconnection. */ | ||
48 | int i; | ||
49 | |||
50 | GPBDAT &= 0x7EF; | ||
51 | GPBCON |= 1<<8; | ||
52 | |||
53 | GPGDAT &= 0xE7FF; | ||
54 | GPGDAT |= 1<<11; | ||
55 | |||
56 | for(i = 0; i < 10000000; i++) { | ||
57 | continue; | ||
58 | } | ||
59 | |||
60 | GPBCON &= 0x2FFCFF; | ||
61 | GPBDAT |= 1<<5; | ||
62 | GPBDAT |= 1<<6; | ||
63 | } | ||
64 | |||
65 | |||
66 | /* Restores a factory kernel/bootloader from a known location */ | ||
67 | /* Restores the FWIMG01.DAT file back in the case of a bootloader failure */ | ||
68 | /* The factory or "good" bootloader must be in /GBSYSTEM/FWIMG/FWIMG01.DAT.ORIG */ | ||
69 | /* Returns non-zero on failure */ | ||
70 | int restore_fwimg01dat(void) | ||
71 | { | ||
72 | int orig_file = 0, dest_file = 0; | ||
73 | int size = 0, size_read; | ||
74 | static char buf[4096]; | ||
75 | |||
76 | orig_file = open("/GBSYSTEM/FWIMG/FWIMG01.DAT.ORIG", O_RDONLY); | ||
77 | if(orig_file < 0) { | ||
78 | /* Couldn't open source file */ | ||
79 | printf("Couldn't open FWIMG01.DAT.ORIG for reading"); | ||
80 | return(1); | ||
81 | } | ||
82 | |||
83 | printf("FWIMG01.DAT.ORIG opened for reading"); | ||
84 | |||
85 | dest_file = open("/GBSYSTEM/FWIMG/FWIMG01.DAT", O_RDWR); | ||
86 | if(dest_file < 0) { | ||
87 | /* Couldn't open destination file */ | ||
88 | printf("Couldn't open FWIMG01.DAT.ORIG for writing"); | ||
89 | close(orig_file); | ||
90 | return(2); | ||
91 | } | ||
92 | |||
93 | printf("FWIMG01.DAT opened for writing"); | ||
94 | |||
95 | do { | ||
96 | /* Copy in chunks */ | ||
97 | size_read = read(orig_file, buf, sizeof(buf)); | ||
98 | if(size_read != write(dest_file, buf, size_read)) { | ||
99 | close(orig_file); | ||
100 | close(dest_file); | ||
101 | return(3); | ||
102 | } | ||
103 | size += size_read; | ||
104 | |||
105 | } while(size_read > 0); | ||
106 | |||
107 | close(orig_file); | ||
108 | close(dest_file); | ||
109 | |||
110 | printf("Finished copying %ld bytes from", size); | ||
111 | printf("FWIMG01.DAT.ORIG to FWIMG01.DAT"); | ||
112 | |||
113 | return(0); | ||
114 | } | ||
115 | |||
116 | char buf[256]; | ||
117 | |||
118 | void display_instructions(void) | ||
119 | { | ||
120 | lcd_setfont(FONT_SYSFIXED); | ||
121 | printf("Hold MENU when booting for rescue mode."); | ||
122 | printf(" \"VOL+\" button to restore original kernel"); | ||
123 | printf(" \"A\" button to load original firmware"); | ||
124 | printf(""); | ||
125 | printf("FRAME %x TTB %x", FRAME, TTB_BASE); | ||
126 | } | ||
127 | |||
128 | void * main(void) | ||
129 | { | ||
130 | int i; | ||
131 | struct partinfo* pinfo; | ||
132 | unsigned short* identify_info; | ||
133 | unsigned char* loadbuffer; | 52 | unsigned char* loadbuffer; |
134 | int buffer_size; | 53 | int buffer_size; |
135 | bool load_original = false; | ||
136 | int rc; | 54 | int rc; |
137 | int(*kernel_entry)(void); | 55 | int(*kernel_entry)(void); |
138 | 56 | ||
139 | bool show_bootsplash = true; | 57 | memory_init(); |
140 | 58 | power_init(); | |
141 | if(GPGDAT & 2) | 59 | system_init(); |
142 | show_bootsplash = false; | 60 | lcd_init(); |
61 | backlight_init(); | ||
62 | font_init(); | ||
143 | 63 | ||
144 | if(!show_bootsplash) { | 64 | lcd_setfont(FONT_SYSFIXED); |
145 | lcd_init(); | ||
146 | display_instructions(); | ||
147 | sleep(2*HZ); | ||
148 | } | ||
149 | if(GPGDAT & 2) { | ||
150 | lcd_init(); | ||
151 | printf("Entering rescue mode.."); | ||
152 | go_usb_mode(); | ||
153 | while(1); | ||
154 | } | ||
155 | if(GPGDAT & 0x10) { | ||
156 | lcd_init(); | ||
157 | load_original = true; | ||
158 | printf("Loading original firmware..."); | ||
159 | } | ||
160 | |||
161 | i = ata_init(); | ||
162 | i = disk_mount_all(); | ||
163 | if(!show_bootsplash) { | ||
164 | printf("disk_mount_all: %d", i); | ||
165 | } | ||
166 | if(show_bootsplash) { | ||
167 | int fd = open("/bootsplash.raw", O_RDONLY); | ||
168 | if(fd < 0) { | ||
169 | show_bootsplash = false; | ||
170 | lcd_init(); | ||
171 | display_instructions(); | ||
172 | } | ||
173 | else { | ||
174 | read(fd, lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT*2); | ||
175 | close(fd); | ||
176 | lcd_update(); | ||
177 | lcd_init(); | ||
178 | } | ||
179 | } | ||
180 | /* hold VOL+ to enter rescue mode to copy old image */ | ||
181 | /* needs to be after ata_init and disk_mount_all */ | ||
182 | if(GPGDAT & 4) { | ||
183 | |||
184 | /* Try to restore the original kernel/bootloader if a copy is found */ | ||
185 | printf("Restoring FWIMG01.DAT..."); | ||
186 | |||
187 | if(!restore_fwimg01dat()) { | ||
188 | printf("Restoring FWIMG01.DAT successful."); | ||
189 | } else { | ||
190 | printf("Restoring FWIMG01.DAT failed."); | ||
191 | } | ||
192 | |||
193 | printf("Now power cycle to boot original"); | ||
194 | while(1); | ||
195 | } | ||
196 | |||
197 | if(!show_bootsplash) { | ||
198 | identify_info = ata_get_identify(); | ||
199 | |||
200 | for(i=0; i < 20; i++) | ||
201 | ((unsigned short*)buf)[i]=htobe16(identify_info[i+27]); | ||
202 | |||
203 | buf[40]=0; | ||
204 | 65 | ||
205 | /* kill trailing space */ | 66 | usb_init(); |
206 | for(i=39; i && buf[i]==' '; i--) | ||
207 | buf[i] = 0; | ||
208 | 67 | ||
209 | printf("Model"); | 68 | /* Enter USB mode without USB thread */ |
210 | printf(buf); | 69 | if(usb_detect()) |
70 | { | ||
71 | const char msg[] = "Bootloader USB mode"; | ||
72 | reset_screen(); | ||
73 | lcd_putsxy( (LCD_WIDTH - (SYSFONT_WIDTH * strlen(msg))) / 2, | ||
74 | (LCD_HEIGHT - SYSFONT_HEIGHT) / 2, msg); | ||
75 | lcd_update(); | ||
211 | 76 | ||
212 | for(i=0; i < 4; i++) | 77 | ata_enable(false); |
213 | ((unsigned short*)buf)[i]=htobe16(identify_info[i+23]); | 78 | sleep(HZ/20); |
79 | usb_enable(true); | ||
214 | 80 | ||
215 | buf[8]=0; | 81 | while (usb_detect()) |
82 | sleep(HZ); | ||
216 | 83 | ||
217 | printf("Firmware"); | 84 | usb_enable(false); |
218 | printf(buf); | ||
219 | 85 | ||
220 | pinfo = disk_partinfo(0); | 86 | reset_screen(); |
221 | printf("Partition 0: 0x%02x %ld MB", pinfo->type, pinfo->size / 2048); | 87 | lcd_update(); |
88 | } | ||
89 | |||
90 | kernel_init(); | ||
91 | adc_init(); | ||
92 | button_init(); | ||
93 | |||
94 | /* Show debug messages if button is pressed */ | ||
95 | if(button_read_device()) | ||
96 | verbose = true; | ||
97 | |||
98 | printf("Rockbox boot loader"); | ||
99 | printf("Version %s", version); | ||
100 | |||
101 | rc = ata_init(); | ||
102 | if(rc) | ||
103 | { | ||
104 | reset_screen(); | ||
105 | error(EATA, rc); | ||
222 | } | 106 | } |
223 | /* Load original firmware */ | ||
224 | if(load_original) { | ||
225 | loadbuffer = (unsigned char*)0x30008000; | ||
226 | buffer_size =(unsigned char*)0x31000000 - loadbuffer; | ||
227 | rc = load_raw_firmware(loadbuffer, "/rockbox.gigabeat", buffer_size); | ||
228 | if(rc < EOK) { | ||
229 | printf("Error!"); | ||
230 | printf("Failed to load original firmware:"); | ||
231 | printf(strerror(rc)); | ||
232 | printf("Loading rockbox"); | ||
233 | sleep(2*HZ); | ||
234 | goto load_rockbox; | ||
235 | } | ||
236 | |||
237 | printf("Loaded: %d", rc); | ||
238 | sleep(2*HZ); | ||
239 | 107 | ||
240 | (*((int*)0x7000000)) = 333; | 108 | disk_init(); |
241 | rc = *((int*)0x7000000+0x8000000); | ||
242 | printf("Bank0 mem test: %d", rc); | ||
243 | sleep(3*HZ); | ||
244 | 109 | ||
245 | printf("Woops, should not return from firmware!"); | 110 | rc = disk_mount_all(); |
246 | goto usb; | 111 | if (rc<=0) |
112 | { | ||
113 | error(EDISK,rc); | ||
247 | } | 114 | } |
248 | 115 | ||
249 | load_rockbox: | 116 | printf("Loading firmware"); |
250 | map_memory(); | ||
251 | if(!show_bootsplash) { | ||
252 | printf("Loading Rockbox..."); | ||
253 | } | ||
254 | 117 | ||
255 | loadbuffer = (unsigned char*) 0x100; | 118 | loadbuffer = (unsigned char*) 0x100; |
256 | buffer_size = (unsigned char*)0x400000 - loadbuffer; | 119 | buffer_size = (unsigned char*)0x400000 - loadbuffer; |
257 | rc = load_raw_firmware(loadbuffer, "/.rockbox/rockbox.gigabeat", buffer_size); | 120 | |
258 | if(rc < EOK) { | 121 | rc = load_firmware(loadbuffer, BOOTFILE, buffer_size); |
259 | rc = load_raw_firmware(loadbuffer, "/rockbox.gigabeat", buffer_size); | 122 | if(rc < 0) |
260 | } | 123 | error(EBOOTFILE, rc); |
261 | if(rc < EOK) { | 124 | |
262 | printf("Error!"); | 125 | if (rc == EOK) |
263 | printf("Can't load rockbox.gigabeat:"); | 126 | { |
264 | printf(strerror(rc)); | ||
265 | } else { | ||
266 | if(!show_bootsplash) { | ||
267 | printf("Rockbox loaded."); | ||
268 | } | ||
269 | kernel_entry = (void*) loadbuffer; | 127 | kernel_entry = (void*) loadbuffer; |
270 | rc = kernel_entry(); | 128 | rc = kernel_entry(); |
271 | printf("Woops, should not return from firmware: %d", rc); | ||
272 | goto usb; | ||
273 | } | 129 | } |
274 | usb: | ||
275 | /* now wait in USB mode so the bootloader can be updated */ | ||
276 | go_usb_mode(); | ||
277 | while(1); | ||
278 | |||
279 | return((void *)0); | ||
280 | } | 130 | } |
281 | 131 | ||
diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h index ef6d8243b8..6a6e1d2977 100644 --- a/firmware/export/config-gigabeat.h +++ b/firmware/export/config-gigabeat.h | |||
@@ -6,7 +6,7 @@ | |||
6 | #define TOSHIBA_GIGABEAT_F 1 | 6 | #define TOSHIBA_GIGABEAT_F 1 |
7 | 7 | ||
8 | /* For Rolo and boot loader */ | 8 | /* For Rolo and boot loader */ |
9 | #define MODEL_NUMBER 1 | 9 | #define MODEL_NUMBER 18 |
10 | 10 | ||
11 | /* define this if you have a bitmap LCD display */ | 11 | /* define this if you have a bitmap LCD display */ |
12 | #define HAVE_LCD_BITMAP | 12 | #define HAVE_LCD_BITMAP |
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c index bc2b53d776..34fbc2b2ac 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c +++ b/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c | |||
@@ -52,8 +52,8 @@ void ata_enable(bool on) | |||
52 | else | 52 | else |
53 | USB_ATA_ENABLE; | 53 | USB_ATA_ENABLE; |
54 | 54 | ||
55 | GPBCON=( GPGCON&~(1<<11) ) | (1<<10); /* Make the pin an output */ | 55 | GPBCON=( GPBCON&~(1<<11) ) | (1<<10); /* Make the pin an output */ |
56 | // GPBUP|=1<<5; /* Disable pullup in SOC as we are now driving */ | 56 | GPBUP|=1<<5; /* Disable pullup in SOC as we are now driving */ |
57 | } | 57 | } |
58 | 58 | ||
59 | bool ata_is_coldstart(void) | 59 | bool ata_is_coldstart(void) |
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c index 1bb68f9686..11edcfecb1 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c +++ b/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c | |||
@@ -53,6 +53,23 @@ unsigned int LCDBASEL(unsigned int address) | |||
53 | /* LCD init */ | 53 | /* LCD init */ |
54 | void lcd_init_device(void) | 54 | void lcd_init_device(void) |
55 | { | 55 | { |
56 | #ifdef BOOTLOADER | ||
57 | /* When the Rockbox bootloader starts, we are changing framebuffer address, | ||
58 | but we don't want what's shown on the LCD to change until we do an | ||
59 | lcd_update(), so copy the data from the old framebuffer to the new one */ | ||
60 | int i; | ||
61 | unsigned short *buf = (unsigned short*)FRAME; | ||
62 | |||
63 | memcpy(FRAME, (short *)((LCDSADDR1)<<1), 320*240*2); | ||
64 | |||
65 | /* The Rockbox bootloader is transitioning from RGB555I to RGB565 mode | ||
66 | so convert the frambuffer data accordingly */ | ||
67 | for(i=0; i< 320*240; i++){ | ||
68 | *buf = ((*buf>>1) & 0x1F) | (*buf & 0xffc0); | ||
69 | buf++; | ||
70 | } | ||
71 | #endif | ||
72 | |||
56 | LCDSADDR1 = (LCDBANK((unsigned)FRAME) << 21) | (LCDBASEU((unsigned)FRAME)); | 73 | LCDSADDR1 = (LCDBANK((unsigned)FRAME) << 21) | (LCDBASEU((unsigned)FRAME)); |
57 | LCDSADDR2 = LCDBASEL((unsigned)FRAME); | 74 | LCDSADDR2 = LCDBASEL((unsigned)FRAME); |
58 | LCDSADDR3 = 0x000000F0; | 75 | LCDSADDR3 = 0x000000F0; |
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.c index 6142213f0c..c47c1330bc 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.c +++ b/firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.c | |||
@@ -3,7 +3,6 @@ | |||
3 | #include "mmu-meg-fx.h" | 3 | #include "mmu-meg-fx.h" |
4 | #include "panic.h" | 4 | #include "panic.h" |
5 | 5 | ||
6 | void map_memory(void); | ||
7 | static void enable_mmu(void); | 6 | static void enable_mmu(void); |
8 | static void set_ttb(void); | 7 | static void set_ttb(void); |
9 | static void set_page_tables(void); | 8 | static void set_page_tables(void); |
@@ -15,7 +14,7 @@ static void map_section(unsigned int pa, unsigned int va, int mb, int cache_flag | |||
15 | #define BUFFERED (1 << 2) | 14 | #define BUFFERED (1 << 2) |
16 | #define MB (1 << 20) | 15 | #define MB (1 << 20) |
17 | 16 | ||
18 | void map_memory(void) { | 17 | void memory_init(void) { |
19 | set_ttb(); | 18 | set_ttb(); |
20 | set_page_tables(); | 19 | set_page_tables(); |
21 | enable_mmu(); | 20 | enable_mmu(); |
@@ -69,6 +68,20 @@ void map_section(unsigned int pa, unsigned int va, int mb, int cache_flags) { | |||
69 | } | 68 | } |
70 | 69 | ||
71 | static void enable_mmu(void) { | 70 | static void enable_mmu(void) { |
71 | int regread; | ||
72 | |||
73 | asm volatile( | ||
74 | "MRC p15, 0, %r0, c1, c0, 0\n" /* Read reg1, control register */ | ||
75 | : /* outputs */ | ||
76 | "=r"(regread) | ||
77 | : /* inputs */ | ||
78 | : /* clobbers */ | ||
79 | "r0" | ||
80 | ); | ||
81 | |||
82 | if ( !(regread & 0x04) || !(regread & 0x00001000) ) /* Was the ICache or DCache Enabled? */ | ||
83 | clean_dcache(); /* If so we need to clean the DCache before invalidating below */ | ||
84 | |||
72 | asm volatile("mov r0, #0\n" | 85 | asm volatile("mov r0, #0\n" |
73 | "mcr p15, 0, r0, c8, c7, 0\n" /* invalidate TLB */ | 86 | "mcr p15, 0, r0, c8, c7, 0\n" /* invalidate TLB */ |
74 | 87 | ||
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.h b/firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.h index 71b1b83801..524978852d 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.h +++ b/firmware/target/arm/s3c2440/gigabeat-fx/mmu-meg-fx.h | |||
@@ -32,4 +32,4 @@ void dump_dcache_range(const void *base, unsigned int size); | |||
32 | /* Cleans entire DCache */ | 32 | /* Cleans entire DCache */ |
33 | void clean_dcache(void); | 33 | void clean_dcache(void); |
34 | 34 | ||
35 | 35 | void memory_init(void); | |
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c index b7e59e66ea..6c5e35f0d5 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c +++ b/firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include "kernel.h" | 1 | #include "kernel.h" |
2 | #include "system.h" | 2 | #include "system.h" |
3 | #include "panic.h" | 3 | #include "panic.h" |
4 | #include "mmu-meg-fx.h" | ||
4 | 5 | ||
5 | #include "lcd.h" | 6 | #include "lcd.h" |
6 | #include <stdio.h> | 7 | #include <stdio.h> |
@@ -11,6 +12,7 @@ const int DMA0_MASK = (1 << 17); | |||
11 | const int DMA1_MASK = (1 << 18); | 12 | const int DMA1_MASK = (1 << 18); |
12 | const int DMA2_MASK = (1 << 19); | 13 | const int DMA2_MASK = (1 << 19); |
13 | const int DMA3_MASK = (1 << 20); | 14 | const int DMA3_MASK = (1 << 20); |
15 | const int ALARM_MASK = (1 << 30); | ||
14 | 16 | ||
15 | int system_memory_guard(int newmode) | 17 | int system_memory_guard(int newmode) |
16 | { | 18 | { |
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/usb-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/usb-meg-fx.c index 3aed8c3256..af66e2a60c 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/usb-meg-fx.c +++ b/firmware/target/arm/s3c2440/gigabeat-fx/usb-meg-fx.c | |||
@@ -44,7 +44,7 @@ inline bool usb_detect(void) | |||
44 | void usb_init_device(void) | 44 | void usb_init_device(void) |
45 | { | 45 | { |
46 | /* Input is the default configuration, only pullups need to be disabled */ | 46 | /* Input is the default configuration, only pullups need to be disabled */ |
47 | GPFUP|=0x02; | 47 | /* GPFUP|=0x02; */ |
48 | 48 | ||
49 | USB_VPLUS_PWR_ASSERT; | 49 | USB_VPLUS_PWR_ASSERT; |
50 | GPBCON=( GPBCON&~(1<<13) ) | (1 << 12); | 50 | GPBCON=( GPBCON&~(1<<13) ) | (1 << 12); |
diff --git a/tools/configure b/tools/configure index 2f79755335..a507fdd31a 100755 --- a/tools/configure +++ b/tools/configure | |||
@@ -1048,7 +1048,7 @@ EOF | |||
1048 | target="-DGIGABEAT_F" | 1048 | target="-DGIGABEAT_F" |
1049 | memory=32 # always | 1049 | memory=32 # always |
1050 | arm9tdmicc | 1050 | arm9tdmicc |
1051 | tool="cp" | 1051 | tool="$rootdir/tools/scramble -add=giga" |
1052 | bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" | 1052 | bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" |
1053 | bmp2rb_native="$rootdir/tools/bmp2rb -f 4" | 1053 | bmp2rb_native="$rootdir/tools/bmp2rb -f 4" |
1054 | output="rockbox.gigabeat" | 1054 | output="rockbox.gigabeat" |
diff --git a/tools/scramble.c b/tools/scramble.c index 9a64a5aeed..531728379d 100644 --- a/tools/scramble.c +++ b/tools/scramble.c | |||
@@ -224,6 +224,8 @@ int main (int argc, char** argv) | |||
224 | modelnum = 16; | 224 | modelnum = 16; |
225 | else if(!strcmp(&argv[1][5], "iam5")) | 225 | else if(!strcmp(&argv[1][5], "iam5")) |
226 | modelnum = 17; | 226 | modelnum = 17; |
227 | else if(!strcmp(&argv[1][5], "giga")) | ||
228 | modelnum = 18; | ||
227 | else { | 229 | else { |
228 | fprintf(stderr, "unsupported model: %s\n", &argv[1][5]); | 230 | fprintf(stderr, "unsupported model: %s\n", &argv[1][5]); |
229 | return 2; | 231 | return 2; |