summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg White <gwhite@rockbox.org>2007-01-13 02:24:15 +0000
committerGreg White <gwhite@rockbox.org>2007-01-13 02:24:15 +0000
commit355be5010af1e33c0f3b36af85033bd31f996491 (patch)
tree1e83cefbe3d313179bda383a5ad508adaff8ffac
parent35b0c3f24f279eb8056e54094cb12310802f6709 (diff)
downloadrockbox-355be5010af1e33c0f3b36af85033bd31f996491.tar.gz
rockbox-355be5010af1e33c0f3b36af85033bd31f996491.zip
Setup LCD ourselves; move LCD buffer and TTB to free up 1.7MB of memory
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11994 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/plugin.lds14
-rw-r--r--bootloader/gigabeat.c13
-rw-r--r--firmware/app.lds13
-rw-r--r--firmware/export/config-gigabeat.h4
-rw-r--r--firmware/export/lcd.h2
-rw-r--r--firmware/export/s3c2440.h9
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c11
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c12
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c45
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/mmu-meg-fx.c9
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/system-meg-fx.c1
-rwxr-xr-xtools/configure116
12 files changed, 142 insertions, 107 deletions
diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds
index 52a5cc32a5..5181e5604d 100644
--- a/apps/plugins/plugin.lds
+++ b/apps/plugins/plugin.lds
@@ -37,6 +37,8 @@ OUTPUT_FORMAT(elf32-sh)
37#define IRAMORIG 0x407000 37#define IRAMORIG 0x407000
38#define IRAMSIZE 0x9000 38#define IRAMSIZE 0x9000
39#elif CONFIG_CPU == S3C2440 39#elif CONFIG_CPU == S3C2440
40#include "s3c2440.h"
41#define DRAMSIZE (MEMORYSIZE * 0x100000) - 0x100 - STUBOFFSET - LCD_BUFFER_SIZE - TTB_SIZE - PLUGIN_BUFFER_SIZE - CODEC_SIZE
40#define DRAMORIG 0x100 + STUBOFFSET 42#define DRAMORIG 0x100 + STUBOFFSET
41#define IRAMORIG DRAMORIG 43#define IRAMORIG DRAMORIG
42#define IRAMSIZE 4K 44#define IRAMSIZE 4K
@@ -46,11 +48,13 @@ OUTPUT_FORMAT(elf32-sh)
46#endif 48#endif
47 49
48#define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE 50#define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE
51
52#if CONFIG_CPU != S3C2440
49#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_LENGTH - CODEC_SIZE 53#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_LENGTH - CODEC_SIZE
54#endif
50#define CODEC_ORIGIN (DRAMORIG + (DRAMSIZE)) 55#define CODEC_ORIGIN (DRAMORIG + (DRAMSIZE))
51#define PLUGIN_ORIGIN (CODEC_ORIGIN + CODEC_SIZE) 56#define PLUGIN_ORIGIN (CODEC_ORIGIN + CODEC_SIZE)
52 57
53
54#ifdef CODEC 58#ifdef CODEC
55#define THIS_LENGTH CODEC_SIZE 59#define THIS_LENGTH CODEC_SIZE
56#define THIS_ORIGIN CODEC_ORIGIN 60#define THIS_ORIGIN CODEC_ORIGIN
@@ -84,7 +88,7 @@ SECTIONS
84#endif 88#endif
85 } > PLUGIN_RAM 89 } > PLUGIN_RAM
86 90
87 .rodata : 91 .rodata :
88 { 92 {
89 *(.rodata*) 93 *(.rodata*)
90 . = ALIGN(0x4); 94 . = ALIGN(0x4);
@@ -98,7 +102,7 @@ SECTIONS
98#endif 102#endif
99 } > PLUGIN_RAM 103 } > PLUGIN_RAM
100 104
101 /DISCARD/ : 105 /DISCARD/ :
102 { 106 {
103 *(.eh_frame) 107 *(.eh_frame)
104 } 108 }
@@ -124,7 +128,7 @@ SECTIONS
124 128
125 .bss (NOLOAD) : 129 .bss (NOLOAD) :
126 { 130 {
127 plugin_bss_start = .; 131 plugin_bss_start = .;
128 *(.bss*) 132 *(.bss*)
129 *(COMMON) 133 *(COMMON)
130 . = ALIGN(0x4); 134 . = ALIGN(0x4);
@@ -134,7 +138,7 @@ SECTIONS
134 138
135 /* Special trick to avoid a linker error when no other sections are 139 /* Special trick to avoid a linker error when no other sections are
136 left after garbage collection (plugin not for this platform) */ 140 left after garbage collection (plugin not for this platform) */
137 .comment 0 : 141 .comment 0 :
138 { 142 {
139 KEEP(*(.comment)) 143 KEEP(*(.comment))
140 } 144 }
diff --git a/bootloader/gigabeat.c b/bootloader/gigabeat.c
index 62c31310ae..38e8bbf63e 100644
--- a/bootloader/gigabeat.c
+++ b/bootloader/gigabeat.c
@@ -70,8 +70,8 @@ void memdump(void)
70 70
71 data = *(volatile int *)memlocations[i].address; 71 data = *(volatile int *)memlocations[i].address;
72 72
73 snprintf(tmp, sizeof(tmp), "%s %s 0x%08X", 73 snprintf(tmp, sizeof(tmp), "%s %s 0x%08X",
74 (i==current) ? "*" : " ", 74 (i==current) ? "*" : " ",
75 memlocations[i].desc, 75 memlocations[i].desc,
76 data); 76 data);
77 lcd_puts(0, i*2+5, tmp); 77 lcd_puts(0, i*2+5, tmp);
@@ -323,6 +323,9 @@ void * main(void)
323 lcd_puts(0, line++, "Hold MENU when booting for rescue mode."); 323 lcd_puts(0, line++, "Hold MENU when booting for rescue mode.");
324 lcd_puts(0, line++, " \"VOL+\" button to restore original kernel"); 324 lcd_puts(0, line++, " \"VOL+\" button to restore original kernel");
325 lcd_puts(0, line++, " \"A\" button to load original firmware"); 325 lcd_puts(0, line++, " \"A\" button to load original firmware");
326 line++;
327 snprintf(buf, sizeof(buf), "FRAME %x TTB %x", FRAME, TTB_BASE);
328 lcd_puts(0, line++, buf);
326 lcd_update(); 329 lcd_update();
327 sleep(1*HZ); 330 sleep(1*HZ);
328 331
@@ -334,7 +337,7 @@ void * main(void)
334 while(1); 337 while(1);
335 } 338 }
336 339
337 sleep(5*HZ); 340 sleep(1*HZ);
338 341
339 if(GPGDAT & 0x10) { 342 if(GPGDAT & 0x10) {
340 load_original = true; 343 load_original = true;
@@ -434,7 +437,7 @@ load_rockbox:
434 map_memory(); 437 map_memory();
435 lcd_puts(0, line, "Loading Rockbox..."); 438 lcd_puts(0, line, "Loading Rockbox...");
436 lcd_update(); 439 lcd_update();
437 sleep(HZ*4); 440 /* sleep(HZ*4); */
438 441
439 // TODO: read those values from somwhere 442 // TODO: read those values from somwhere
440 loadbuffer = (unsigned char*) 0x100; 443 loadbuffer = (unsigned char*) 0x100;
@@ -447,7 +450,7 @@ load_rockbox:
447 } else { 450 } else {
448 lcd_puts(0, line++, "Rockbox loaded."); 451 lcd_puts(0, line++, "Rockbox loaded.");
449 lcd_update(); 452 lcd_update();
450 kernel_entry = (void*)0x100; 453 kernel_entry = (void*) loadbuffer;
451 rc = kernel_entry(); 454 rc = kernel_entry();
452 snprintf(buf, sizeof(buf), "Woops, should not return from firmware: %d", rc); 455 snprintf(buf, sizeof(buf), "Woops, should not return from firmware: %d", rc);
453 lcd_puts(0, line++, buf); 456 lcd_puts(0, line++, buf);
diff --git a/firmware/app.lds b/firmware/app.lds
index 1053437106..02c204a2a8 100644
--- a/firmware/app.lds
+++ b/firmware/app.lds
@@ -26,8 +26,9 @@ INPUT(target/sh/crt0.o)
26#define STUBOFFSET 0 26#define STUBOFFSET 0
27#endif 27#endif
28 28
29#if CONFIG_CPU!=S3C2440
29#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE - STUBOFFSET - CODECSIZE 30#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE - STUBOFFSET - CODECSIZE
30 31#endif
31#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300) 32#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300)
32#define DRAMORIG 0x31000000 + STUBOFFSET 33#define DRAMORIG 0x31000000 + STUBOFFSET
33#define IRAMORIG 0x10000000 34#define IRAMORIG 0x10000000
@@ -45,7 +46,9 @@ INPUT(target/sh/crt0.o)
45#define IRAMORIG 0x400000 46#define IRAMORIG 0x400000
46#define IRAMSIZE 0x7000 47#define IRAMSIZE 0x7000
47#elif CONFIG_CPU==S3C2440 48#elif CONFIG_CPU==S3C2440
48#define DRAMORIG 0x100 + STUBOFFSET 49#include "s3c2440.h"
50#define DRAMORIG (0x100 + STUBOFFSET)
51#define DRAMSIZE (MEMORYSIZE * 0x100000) - 0x100 - STUBOFFSET - LCD_BUFFER_SIZE - TTB_SIZE - PLUGINSIZE - CODECSIZE
49#define IRAMORIG DRAMORIG 52#define IRAMORIG DRAMORIG
50#define IRAMSIZE 4K 53#define IRAMSIZE 4K
51#define IRAM DRAM 54#define IRAM DRAM
@@ -126,7 +129,7 @@ SECTIONS
126 _dataend = .; 129 _dataend = .;
127 } > DRAM 130 } > DRAM
128 131
129 /DISCARD/ : 132 /DISCARD/ :
130 { 133 {
131 *(.eh_frame) 134 *(.eh_frame)
132 } 135 }
@@ -163,7 +166,7 @@ SECTIONS
163 } > IRAM AT> DRAM 166 } > IRAM AT> DRAM
164 167
165 _iramcopy = LOADADDR(.iram); 168 _iramcopy = LOADADDR(.iram);
166 169
167 .ibss (NOLOAD) : 170 .ibss (NOLOAD) :
168 { 171 {
169 _iedata = .; 172 _iedata = .;
@@ -180,7 +183,7 @@ SECTIONS
180 . += 0x2000; 183 . += 0x2000;
181 stackend = .; 184 stackend = .;
182 } > IRAM 185 } > IRAM
183 186
184#ifdef CPU_PP 187#ifdef CPU_PP
185 .cop_stack : 188 .cop_stack :
186 { 189 {
diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h
index 4a1d11d43a..3dbdadf621 100644
--- a/firmware/export/config-gigabeat.h
+++ b/firmware/export/config-gigabeat.h
@@ -86,7 +86,7 @@
86#define BATTERY_TYPES_COUNT 1 /* only one type */ 86#define BATTERY_TYPES_COUNT 1 /* only one type */
87 87
88/* ADC[0] is (530) at discharge and 625 at full charge */ 88/* ADC[0] is (530) at discharge and 625 at full charge */
89#define BATTERY_SCALE_FACTOR 6450 89#define BATTERY_SCALE_FACTOR 6450
90 90
91/* Hardware controlled charging with monitoring */ 91/* Hardware controlled charging with monitoring */
92#define CONFIG_CHARGING CHARGING_MONITOR 92#define CONFIG_CHARGING CHARGING_MONITOR
@@ -132,5 +132,5 @@
132#define BOOTFILE_EXT "gigabeat" 132#define BOOTFILE_EXT "gigabeat"
133#define BOOTFILE "rockbox." BOOTFILE_EXT 133#define BOOTFILE "rockbox." BOOTFILE_EXT
134 134
135 135
136#endif 136#endif
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 8a65d09fa3..37ad2b0cc2 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -347,8 +347,10 @@ extern void lcd_set_drawinfo(int mode, unsigned foreground,
347void lcd_set_backdrop(fb_data* backdrop); 347void lcd_set_backdrop(fb_data* backdrop);
348#if defined(TOSHIBA_GIGABEAT_F) && !defined(SIMULATOR) 348#if defined(TOSHIBA_GIGABEAT_F) && !defined(SIMULATOR)
349void lcd_device_prepare_backdrop(fb_data* backdrop); 349void lcd_device_prepare_backdrop(fb_data* backdrop);
350bool lcd_enabled(void);
350#else 351#else
351#define lcd_device_prepare_backdrop(x) ; 352#define lcd_device_prepare_backdrop(x) ;
353#define lcd_enabled() true
352#endif 354#endif
353 355
354fb_data* lcd_get_backdrop(void); 356fb_data* lcd_get_backdrop(void);
diff --git a/firmware/export/s3c2440.h b/firmware/export/s3c2440.h
index 3c7075acd6..4a799da3e2 100644
--- a/firmware/export/s3c2440.h
+++ b/firmware/export/s3c2440.h
@@ -143,9 +143,12 @@
143#define LCDINTMSK (*(volatile int *)0x4D00005C) /* LCD interrupt mask */ 143#define LCDINTMSK (*(volatile int *)0x4D00005C) /* LCD interrupt mask */
144#define TCONSEL (*(volatile int *)0x4D000060) /* TCON(LPC3600/LCC3600) control */ 144#define TCONSEL (*(volatile int *)0x4D000060) /* TCON(LPC3600/LCC3600) control */
145 145
146/* The following should be computed but for now, we cheat. */ 146#define LCD_BUFFER_SIZE ((320*240*2))
147#define FRAME ( (short *) 0x31E00000 ) /* LCD Frame buffer */ 147#define TTB_SIZE (0x4000)
148 148/*#define FRAME ( (short *) 0x31E00000 ) */ /* LCD Frame buffer - Firmware Address */
149/* must be 16Kb (0x4000) aligned */
150#define TTB_BASE (0x30000000 + (32*1024*1024) - TTB_SIZE) /* End of memory */
151#define FRAME ((short *) (TTB_BASE - LCD_BUFFER_SIZE)) /* Right before TTB */
149/* NAND Flash */ 152/* NAND Flash */
150 153
151#define NFCONF (*(volatile int *)0x4E000000) /* NAND flash configuration */ 154#define NFCONF (*(volatile int *)0x4E000000) /* NAND flash configuration */
diff --git a/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c
index 8e246045e6..00b5e09ed3 100644
--- a/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c
+++ b/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c
@@ -53,10 +53,11 @@ void ata_device_init(void)
53{ 53{
54} 54}
55 55
56#if !defined(BOOTLOADER)
56void copy_read_sectors(unsigned char* buf, int wordcount) 57void copy_read_sectors(unsigned char* buf, int wordcount)
57{ 58{
58 __buttonlight_trigger(); 59 __buttonlight_trigger();
59 60
60 /* Unaligned transfer - slow copy */ 61 /* Unaligned transfer - slow copy */
61 if ( (unsigned long)buf & 1) 62 if ( (unsigned long)buf & 1)
62 { /* not 16-bit aligned, copy byte by byte */ 63 { /* not 16-bit aligned, copy byte by byte */
@@ -94,7 +95,9 @@ void copy_read_sectors(unsigned char* buf, int wordcount)
94 DISRC0 = (int) 0x18000000; 95 DISRC0 = (int) 0x18000000;
95 DISRCC0 = 0x1; 96 DISRCC0 = 0x1;
96 /* Dest mapped to physical address, on AHB bus, increment */ 97 /* Dest mapped to physical address, on AHB bus, increment */
97 DIDST0 = (int) (buf + 0x30000000); 98 DIDST0 = (int) buf;
99 if(DIDST0 < 0x30000000)
100 DIDST0 += 0x30000000;
98 DIDSTC0 = 0; 101 DIDSTC0 = 0;
99 102
100 /* DACK/DREQ Sync to AHB, Int on Transfer complete, Whole service, No reload, 16-bit transfers */ 103 /* DACK/DREQ Sync to AHB, Int on Transfer complete, Whole service, No reload, 16-bit transfers */
@@ -112,10 +115,10 @@ void copy_read_sectors(unsigned char* buf, int wordcount)
112 115
113 /* Wait for transfer to complete */ 116 /* Wait for transfer to complete */
114 while((DSTAT0 & 0x000fffff)) 117 while((DSTAT0 & 0x000fffff))
115 CLKCON |= (1 << 2); /* set IDLE bit */ 118 yield();
116 /* Dump cache for the buffer */ 119 /* Dump cache for the buffer */
117} 120}
118 121#endif
119void dma0(void) 122void dma0(void)
120{ 123{
121} 124}
diff --git a/firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c
index f6a8d31c7b..2f96584515 100644
--- a/firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c
+++ b/firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c
@@ -123,8 +123,8 @@ bool __backlight_init(void)
123 123
124 buttonlight_selected = 0x04; 124 buttonlight_selected = 0x04;
125 125
126 /* delay 2 seconds before any fading */ 126 /* delay 4 seconds before any fading */
127 initial_tick_delay = 2000; 127 initial_tick_delay = 400;
128 /* put the led control on the tick list */ 128 /* put the led control on the tick list */
129 tick_add_task(led_control_service); 129 tick_add_task(led_control_service);
130 130
@@ -272,10 +272,10 @@ void __buttonlight_mode(enum buttonlight_mode mode,
272 */ 272 */
273static void led_control_service(void) 273static void led_control_service(void)
274{ 274{
275 if(initial_tick_delay) { 275 if(initial_tick_delay) {
276 initial_tick_delay--; 276 initial_tick_delay--;
277 return; 277 return;
278 } 278 }
279 switch (backlight_control) 279 switch (backlight_control)
280 { 280 {
281 case BACKLIGHT_CONTROL_IDLE: 281 case BACKLIGHT_CONTROL_IDLE:
diff --git a/firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c
index 778e049dd5..c3a17e16cb 100644
--- a/firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c
+++ b/firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c
@@ -29,21 +29,37 @@ bool lcd_enabled()
29 return lcd_on; 29 return lcd_on;
30} 30}
31 31
32unsigned int LCDBANK(unsigned int address)
33{
34 return ((address >> 22) & 0xff);
35}
36
37unsigned int LCDBASEU(unsigned int address)
38{
39 return (address & ((1 << 22)-1)) >> 1;
40}
41
42unsigned int LCDBASEL(unsigned int address)
43{
44 address += 320*240*2;
45 return (address & ((1 << 22)-1)) >> 1;
46}
47
48
32/* LCD init */ 49/* LCD init */
33void lcd_init_device(void) 50void lcd_init_device(void)
34{ 51{
35 memset16(fg_pattern_blit, fg_pattern, sizeof(fg_pattern_blit)/2); 52 LCDSADDR1 = (LCDBANK((unsigned)FRAME) << 21) | (LCDBASEU((unsigned)FRAME));
36 memset16(bg_pattern_blit, bg_pattern, sizeof(bg_pattern_blit)/2); 53 LCDSADDR2 = LCDBASEL((unsigned)FRAME);
37 clean_dcache_range((void *)fg_pattern_blit, sizeof(fg_pattern_blit)); 54 LCDSADDR3 = 0x000000F0;
38 clean_dcache_range((void *)bg_pattern_blit, sizeof(bg_pattern_blit));
39
40 LCDSADDR1 = 0x18F00000; /* These values are pulled from an F40 */
41 LCDSADDR2 = 0x00112C00; /* They should move FRAME to the correct location */
42 LCDSADDR3 = 0x000000F0; /* TODO: Move FRAME to where we want it */
43 55
44 LCDCON5 |= 1 << 11; /* Switch from 555I mode to 565 mode */ 56 LCDCON5 |= 1 << 11; /* Switch from 555I mode to 565 mode */
45 57
46#if !defined(BOOTLOADER) 58#if !defined(BOOTLOADER)
59 memset16(fg_pattern_blit, fg_pattern, sizeof(fg_pattern_blit)/2);
60 memset16(bg_pattern_blit, bg_pattern, sizeof(bg_pattern_blit)/2);
61 clean_dcache_range((void *)fg_pattern_blit, sizeof(fg_pattern_blit));
62 clean_dcache_range((void *)bg_pattern_blit, sizeof(bg_pattern_blit));
47 use_dma_blit = true; 63 use_dma_blit = true;
48 lcd_poweroff = true; 64 lcd_poweroff = true;
49#endif 65#endif
@@ -66,7 +82,7 @@ void lcd_update_rect(int x, int y, int width, int height)
66 { 82 {
67 /* Wait for this controller to stop pending transfer */ 83 /* Wait for this controller to stop pending transfer */
68 while((DSTAT1 & 0x000fffff)) 84 while((DSTAT1 & 0x000fffff))
69 CLKCON |= (1 << 2); /* set IDLE bit */ 85 yield();
70 86
71 /* Flush DCache */ 87 /* Flush DCache */
72 invalidate_dcache_range((void *)(((int) &lcd_framebuffer)+(y * sizeof(fb_data) * LCD_WIDTH)), (height * sizeof(fb_data) * LCD_WIDTH)); 88 invalidate_dcache_range((void *)(((int) &lcd_framebuffer)+(y * sizeof(fb_data) * LCD_WIDTH)), (height * sizeof(fb_data) * LCD_WIDTH));
@@ -92,7 +108,7 @@ void lcd_update_rect(int x, int y, int width, int height)
92 108
93 /* Wait for transfer to complete */ 109 /* Wait for transfer to complete */
94 while((DSTAT1 & 0x000fffff)) 110 while((DSTAT1 & 0x000fffff))
95 CLKCON |= (1 << 2); /* set IDLE bit */ 111 yield();
96 } 112 }
97 else 113 else
98 memcpy(((char*)FRAME) + (y * sizeof(fb_data) * LCD_WIDTH), ((char *)&lcd_framebuffer) + (y * sizeof(fb_data) * LCD_WIDTH), ((height * sizeof(fb_data) * LCD_WIDTH))); 114 memcpy(((char*)FRAME) + (y * sizeof(fb_data) * LCD_WIDTH), ((char *)&lcd_framebuffer) + (y * sizeof(fb_data) * LCD_WIDTH), ((height * sizeof(fb_data) * LCD_WIDTH)));
@@ -143,9 +159,8 @@ void lcd_clear_display_dma(void)
143 void *src; 159 void *src;
144 bool inc = false; 160 bool inc = false;
145 161
146 if(!lcd_on) { 162 if(!lcd_on)
147 sleep(200); 163 yield();
148 }
149 if (lcd_get_drawmode() & DRMODE_INVERSEVID) 164 if (lcd_get_drawmode() & DRMODE_INVERSEVID)
150 src = fg_pattern_blit; 165 src = fg_pattern_blit;
151 else 166 else
@@ -162,7 +177,7 @@ void lcd_clear_display_dma(void)
162 } 177 }
163 /* Wait for any pending transfer to complete */ 178 /* Wait for any pending transfer to complete */
164 while((DSTAT3 & 0x000fffff)) 179 while((DSTAT3 & 0x000fffff))
165 CLKCON |= (1 << 2); /* set IDLE bit */ 180 yield();
166 DMASKTRIG3 |= 0x4; /* Stop controller */ 181 DMASKTRIG3 |= 0x4; /* Stop controller */
167 DIDST3 = ((int) lcd_framebuffer) + 0x30000000; /* set DMA dest, physical address */ 182 DIDST3 = ((int) lcd_framebuffer) + 0x30000000; /* set DMA dest, physical address */
168 DIDSTC3 = 0; /* Dest on AHB, increment */ 183 DIDSTC3 = 0; /* Dest on AHB, increment */
@@ -182,7 +197,7 @@ void lcd_clear_display_dma(void)
182 197
183 /* Wait for transfer to complete */ 198 /* Wait for transfer to complete */
184 while((DSTAT3 & 0x000fffff)) 199 while((DSTAT3 & 0x000fffff))
185 CLKCON |= (1 << 2); /* set IDLE bit */ 200 yield();
186} 201}
187 202
188void lcd_clear_display(void) 203void lcd_clear_display(void)
diff --git a/firmware/target/arm/gigabeat/meg-fx/mmu-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/mmu-meg-fx.c
index 47abb9d46a..8094ff828f 100644
--- a/firmware/target/arm/gigabeat/meg-fx/mmu-meg-fx.c
+++ b/firmware/target/arm/gigabeat/meg-fx/mmu-meg-fx.c
@@ -1,6 +1,7 @@
1#include <string.h> 1#include <string.h>
2#include "s3c2440.h" 2#include "s3c2440.h"
3#include "mmu-meg-fx.h" 3#include "mmu-meg-fx.h"
4#include "panic.h"
4 5
5void map_memory(void); 6void map_memory(void);
6static void enable_mmu(void); 7static void enable_mmu(void);
@@ -20,7 +21,7 @@ void map_memory(void) {
20 enable_mmu(); 21 enable_mmu();
21} 22}
22 23
23unsigned int* ttb_base; 24unsigned int* ttb_base = (unsigned int *) TTB_BASE;
24const int ttb_size = 4096; 25const int ttb_size = 4096;
25 26
26void set_ttb() { 27void set_ttb() {
@@ -29,7 +30,7 @@ void set_ttb() {
29 int domain_access; 30 int domain_access;
30 31
31 /* must be 16Kb (0x4000) aligned */ 32 /* must be 16Kb (0x4000) aligned */
32 ttb_base = (int*)0x31F00000; 33 ttb_base = (int*) TTB_BASE;
33 for (i=0; i<ttb_size; i++,ttbPtr++) 34 for (i=0; i<ttb_size; i++,ttbPtr++)
34 ttbPtr = 0; 35 ttbPtr = 0;
35 asm volatile("mcr p15, 0, %0, c2, c0, 0" : : "r" (ttb_base)); 36 asm volatile("mcr p15, 0, %0, c2, c0, 0" : : "r" (ttb_base));
@@ -47,8 +48,8 @@ void set_page_tables() {
47 48
48 map_section(0x30000000, 0, 32, CACHE_NONE); /* map RAM to 0 */ 49 map_section(0x30000000, 0, 32, CACHE_NONE); /* map RAM to 0 */
49 50
50 map_section(0x30000000, 0, 30, CACHE_ALL); /* cache the first 30 MB or RAM */ 51 map_section(0x30000000, 0, 32, CACHE_ALL); /* cache the first 31 MB or RAM */
51 map_section(0x31E00000, 0x31E00000, 1, BUFFERED); /* enable buffered writing for the framebuffer */ 52 map_section((int)FRAME, (int)FRAME, 1, BUFFERED); /* enable buffered writing for the framebuffer */
52} 53}
53 54
54void map_section(unsigned int pa, unsigned int va, int mb, int cache_flags) { 55void map_section(unsigned int pa, unsigned int va, int mb, int cache_flags) {
diff --git a/firmware/target/arm/gigabeat/meg-fx/system-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/system-meg-fx.c
index b2b4a6207b..6f48a76452 100644
--- a/firmware/target/arm/gigabeat/meg-fx/system-meg-fx.c
+++ b/firmware/target/arm/gigabeat/meg-fx/system-meg-fx.c
@@ -59,6 +59,7 @@ void system_init(void)
59 59
60 /* Turn off AC97 and Camera */ 60 /* Turn off AC97 and Camera */
61 CLKCON &= ~( (1<<19) | (1<<20) ); 61 CLKCON &= ~( (1<<19) | (1<<20) );
62
62} 63}
63 64
64 65
diff --git a/tools/configure b/tools/configure
index 1cfc4cc104..e2e0befae5 100755
--- a/tools/configure
+++ b/tools/configure
@@ -167,7 +167,7 @@ simcc () {
167 exit 167 exit
168 ;; 168 ;;
169 esac 169 esac
170 170
171 if [ "`uname -m`" = "x86_64" ]; then 171 if [ "`uname -m`" = "x86_64" ]; then
172 GCCOPTS="$GCCOPTS -fPIC" # needed to make shared objects link 172 GCCOPTS="$GCCOPTS -fPIC" # needed to make shared objects link
173 fi 173 fi
@@ -284,7 +284,7 @@ whichdevel () {
284 echo "done" 284 echo "done"
285 cont=0 285 cont=0
286 ;; 286 ;;
287 esac 287 esac
288 done 288 done
289 289
290 if [ "yes" = "$use_debug" ]; then 290 if [ "yes" = "$use_debug" ]; then
@@ -402,7 +402,7 @@ voiceconfig () {
402 NOISEFLOOR=$DEFAULT_NOISEFLOOR 402 NOISEFLOOR=$DEFAULT_NOISEFLOOR
403 esac 403 esac
404 echo "Using $TTS_ENGINE for TTS" 404 echo "Using $TTS_ENGINE for TTS"
405 405
406 echo "" 406 echo ""
407 407
408 if [ `which oggenc` ]; then 408 if [ `which oggenc` ]; then
@@ -416,7 +416,7 @@ voiceconfig () {
416 SPEEXENC="(S)peexenc " 416 SPEEXENC="(S)peexenc "
417 DEFAULT_ENC="speexenc" 417 DEFAULT_ENC="speexenc"
418 SPEEX_OPTS="" # TODO: find appropriate options for speex 418 SPEEX_OPTS="" # TODO: find appropriate options for speex
419 DEFAULT_ENC_OPTS=$SPEEX_OPTS 419 DEFAULT_ENC_OPTS=$SPEEX_OPTS
420 DEFAULT_CHOICE="S" 420 DEFAULT_CHOICE="S"
421 fi 421 fi
422 if [ `which lame` ]; then 422 if [ `which lame` ]; then
@@ -464,32 +464,32 @@ ${ENC_OPTS}
464EOF 464EOF
465} 465}
466 466
467picklang() { 467picklang() {
468 # figure out which languages that are around 468 # figure out which languages that are around
469 for file in $rootdir/apps/lang/*.lang; do 469 for file in $rootdir/apps/lang/*.lang; do
470 clean=`echo $file | sed -e 's:.*/::g' | cut "-d." -f1` 470 clean=`echo $file | sed -e 's:.*/::g' | cut "-d." -f1`
471 langs="$langs $clean" 471 langs="$langs $clean"
472 done 472 done
473 473
474 num=1 474 num=1
475 for one in $langs; do 475 for one in $langs; do
476 echo "$num. $one" 476 echo "$num. $one"
477 num=`expr $num + 1` 477 num=`expr $num + 1`
478 done 478 done
479 479
480 read pick 480 read pick
481 return $pick; 481 return $pick;
482} 482}
483 483
484whichlang() { 484whichlang() {
485 num=1 485 num=1
486 for one in $langs; do 486 for one in $langs; do
487 if [ "$num" = "$pick" ]; then 487 if [ "$num" = "$pick" ]; then
488 echo $one 488 echo $one
489 return 489 return
490 fi 490 fi
491 num=`expr $num + 1` 491 num=`expr $num + 1`
492 done 492 done
493} 493}
494 494
495target=$1 495target=$1
@@ -553,17 +553,17 @@ toolsdir='\$(ROOTDIR)/tools'
553 553
554 echo "Enter target platform:" 554 echo "Enter target platform:"
555cat <<EOF 555cat <<EOF
556 ==Archos== ==iriver== ==Apple iPod== 556 ==Archos== ==iriver== ==Apple iPod==
557 0) Player/Studio 10) H120/H140 20) Color/Photo 557 0) Player/Studio 10) H120/H140 20) Color/Photo
558 1) Recorder 11) H320/H340 21) Nano 558 1) Recorder 11) H320/H340 21) Nano
559 2) FM Recorder 12) iHP-100/110/115 22) Video 559 2) FM Recorder 12) iHP-100/110/115 22) Video
560 3) Recorder v2 13) iFP-790 23) 3G 560 3) Recorder v2 13) iFP-790 23) 3G
561 4) Ondio SP 14) H10 20Gb 24) 4G Grayscale 561 4) Ondio SP 14) H10 20Gb 24) 4G Grayscale
562 5) Ondio FM 15) H10 5/6Gb 25) Mini 1G 562 5) Ondio FM 15) H10 5/6Gb 25) Mini 1G
563 26) Mini 2G 563 26) Mini 2G
564 564
565 ==iAudio== ==Toshiba== ==SanDisk== 565 ==iAudio== ==Toshiba== ==SanDisk==
566 30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200 566 30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200
567 567
568 ==Tatung== 568 ==Tatung==
569 60) Elio TPJ-1022 569 60) Elio TPJ-1022
@@ -598,7 +598,7 @@ EOF
598 # output: the final output file name 598 # output: the final output file name
599 # boottool: the tool that takes a plain binary and generates a bootloader 599 # boottool: the tool that takes a plain binary and generates a bootloader
600 # file for your target (or blank to use $tool) 600 # file for your target (or blank to use $tool)
601 # bootoutput:the final output file name for the bootloader (or blank to use 601 # bootoutput:the final output file name for the bootloader (or blank to use
602 # $output) 602 # $output)
603 # appextra: passed to the APPEXTRA variable in the Makefiles. 603 # appextra: passed to the APPEXTRA variable in the Makefiles.
604 # TODO: add proper explanation 604 # TODO: add proper explanation
@@ -953,7 +953,7 @@ EOF
953 t_manufacturer="ipod" 953 t_manufacturer="ipod"
954 t_model="3g" 954 t_model="3g"
955 ;; 955 ;;
956 956
957 24|ipod4g) 957 24|ipod4g)
958 target_id=17 958 target_id=17
959 archos="ipod4g" 959 archos="ipod4g"
@@ -978,7 +978,7 @@ EOF
978 t_manufacturer="ipod" 978 t_manufacturer="ipod"
979 t_model="4g" 979 t_model="4g"
980 ;; 980 ;;
981 981
982 25|ipodmini) 982 25|ipodmini)
983 target_id=18 983 target_id=18
984 archos="ipodmini" 984 archos="ipodmini"
@@ -1003,7 +1003,7 @@ EOF
1003 t_manufacturer="ipod" 1003 t_manufacturer="ipod"
1004 t_model="mini" 1004 t_model="mini"
1005 ;; 1005 ;;
1006 1006
1007 13|ifp7xx) 1007 13|ifp7xx)
1008 target_id=19 1008 target_id=19
1009 archos="ifp7xx" 1009 archos="ifp7xx"
@@ -1031,7 +1031,7 @@ EOF
1031 target_id=20 1031 target_id=20
1032 archos="gigabeatf" 1032 archos="gigabeatf"
1033 target="-DGIGABEAT_F" 1033 target="-DGIGABEAT_F"
1034 memory=30 # always 1034 memory=32 # always
1035 arm9tdmicc 1035 arm9tdmicc
1036 tool="cp" 1036 tool="cp"
1037 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" 1037 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
@@ -1286,7 +1286,7 @@ fi
1286 toolset=''; 1286 toolset='';
1287 apps="manual" 1287 apps="manual"
1288 echo "Manual build selected" 1288 echo "Manual build selected"
1289 ;; 1289 ;;
1290 [Vv]) 1290 [Vv])
1291 echo "Voice build selected" 1291 echo "Voice build selected"
1292 voiceconfig 1292 voiceconfig
@@ -1312,7 +1312,7 @@ fi
1312 ;; 1312 ;;
1313 ipodmini2g) 1313 ipodmini2g)
1314 manualdev="ipodmini" 1314 manualdev="ipodmini"
1315 ;; 1315 ;;
1316 *) 1316 *)
1317 manualdev=$archos 1317 manualdev=$archos
1318 ;; 1318 ;;
@@ -1329,15 +1329,15 @@ language="english"
1329 1329
1330# Ask about language if building voice 1330# Ask about language if building voice
1331if [ "yes" = "$voice" ]; then 1331if [ "yes" = "$voice" ]; then
1332 echo "Select a number for the language to use (default is english)" 1332 echo "Select a number for the language to use (default is english)"
1333 1333
1334 picklang 1334 picklang
1335 language=`whichlang` 1335 language=`whichlang`
1336 1336
1337 if [ -z "$language" ]; then 1337 if [ -z "$language" ]; then
1338 # pick a default 1338 # pick a default
1339 language="english" 1339 language="english"
1340 fi 1340 fi
1341 echo "Language set to $language" 1341 echo "Language set to $language"
1342fi 1342fi
1343 1343
@@ -1378,14 +1378,14 @@ else
1378 1378
1379 echo "Using $CC $gccver ($gccnum)" 1379 echo "Using $CC $gccver ($gccnum)"
1380 1380
1381 if test "$gccnum" -ge "400"; then 1381 if test "$gccnum" -ge "400"; then
1382 # gcc 4.0 is just *so* much pickier on arguments that differ in signedness 1382 # gcc 4.0 is just *so* much pickier on arguments that differ in signedness
1383 # so we ignore that warnings for now 1383 # so we ignore that warnings for now
1384 # -Wno-pointer-sign 1384 # -Wno-pointer-sign
1385 GCCOPTS="$GCCOPTS -Wno-pointer-sign" 1385 GCCOPTS="$GCCOPTS -Wno-pointer-sign"
1386 fi 1386 fi
1387 1387
1388 if test "$gccnum" -ge "401"; then 1388 if test "$gccnum" -ge "401"; then
1389 # this is a lame hack to avoid "warning: dereferencing type-punned pointer 1389 # this is a lame hack to avoid "warning: dereferencing type-punned pointer
1390 # will break strict-aliasing rules" 1390 # will break strict-aliasing rules"
1391 1391
@@ -1396,7 +1396,7 @@ fi
1396 1396
1397# check the compiler for SH platforms 1397# check the compiler for SH platforms
1398if test "$CC" = "sh-elf-gcc"; then 1398if test "$CC" = "sh-elf-gcc"; then
1399 if test "$gccnum" -lt "400"; then 1399 if test "$gccnum" -lt "400"; then
1400 echo "WARNING: Consider upgrading your compiler to the 4.0.X series!" 1400 echo "WARNING: Consider upgrading your compiler to the 4.0.X series!"
1401 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler" 1401 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
1402 else 1402 else
@@ -1689,7 +1689,7 @@ help:
1689 @echo "fontzip - creates rockbox-fonts.zip" 1689 @echo "fontzip - creates rockbox-fonts.zip"
1690 @echo "mapzip - creates rockbox-maps.zip with all .map files" 1690 @echo "mapzip - creates rockbox-maps.zip with all .map files"
1691 @echo "tools - builds the tools only" 1691 @echo "tools - builds the tools only"
1692 @echo "install - installs your build (for simulator builds only)" 1692 @echo "install - installs your build (for simulator builds only)"
1693 1693
1694EOF 1694EOF
1695 1695