diff options
author | Karl Kurbjun <kkurbjun@gmail.com> | 2008-11-12 03:57:32 +0000 |
---|---|---|
committer | Karl Kurbjun <kkurbjun@gmail.com> | 2008-11-12 03:57:32 +0000 |
commit | d42041043b95617244ffdb9150c5e2f2720a8a83 (patch) | |
tree | 71acbd2f8d8d51423d29ddbb2349ed23f77c3151 | |
parent | 68c686957b1b62671d727116e5c167cd8f080148 (diff) | |
download | rockbox-d42041043b95617244ffdb9150c5e2f2720a8a83.tar.gz rockbox-d42041043b95617244ffdb9150c5e2f2720a8a83.zip |
Add in the needed crt0.S code for the wakeup alarm also
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19094 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/plugins/SOURCES | 2 | ||||
-rw-r--r-- | apps/plugins/rockboy/cpu.c | 3 | ||||
-rw-r--r-- | apps/plugins/rockboy/lcd.c | 33 | ||||
-rw-r--r-- | apps/plugins/rockboy/sound.c | 5 | ||||
-rw-r--r-- | bootloader/gigabeat.c | 77 | ||||
-rw-r--r-- | firmware/drivers/audio/wm8751.c | 2 | ||||
-rw-r--r-- | firmware/export/config-gigabeat.h | 3 | ||||
-rw-r--r-- | firmware/target/arm/s3c2440/crt0.S | 16 | ||||
-rw-r--r-- | firmware/target/arm/s3c2440/debug-s3c2440.c | 39 | ||||
-rw-r--r-- | firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/s3c2440/gigabeat-fx/power-meg-fx.c | 121 | ||||
-rw-r--r-- | firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c | 13 |
12 files changed, 284 insertions, 32 deletions
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index a4ddbacfd0..edeaf216a8 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES | |||
@@ -143,6 +143,8 @@ iriverify.c | |||
143 | iriver_flash.c | 143 | iriver_flash.c |
144 | #endif | 144 | #endif |
145 | 145 | ||
146 | gigabeat_flash.c | ||
147 | |||
146 | #endif /* iFP7xx */ | 148 | #endif /* iFP7xx */ |
147 | #if (LCD_WIDTH > 138) && (LCD_DEPTH > 1) | 149 | #if (LCD_WIDTH > 138) && (LCD_DEPTH > 1) |
148 | /* Built for bitmap targets except H10 5/6gb, Archoses, iPod mini, mrobe100 and ifp*/ | 150 | /* Built for bitmap targets except H10 5/6gb, Archoses, iPod mini, mrobe100 and ifp*/ |
diff --git a/apps/plugins/rockboy/cpu.c b/apps/plugins/rockboy/cpu.c index 1aca06f337..f1926fe421 100644 --- a/apps/plugins/rockboy/cpu.c +++ b/apps/plugins/rockboy/cpu.c | |||
@@ -333,8 +333,6 @@ void cpu_timers(int cnt) | |||
333 | 333 | ||
334 | static int cpu_idle(int max) | 334 | static int cpu_idle(int max) |
335 | { | 335 | { |
336 | int cnt, unit; | ||
337 | |||
338 | if (!(cpu.halt && IME)) return 0; | 336 | if (!(cpu.halt && IME)) return 0; |
339 | if (R_IF & R_IE) | 337 | if (R_IF & R_IE) |
340 | { | 338 | { |
@@ -353,6 +351,7 @@ static int cpu_idle(int max) | |||
353 | return max; | 351 | return max; |
354 | } | 352 | } |
355 | 353 | ||
354 | int cnt, unit; | ||
356 | /* Figure out when the next timer interrupt will happen */ | 355 | /* Figure out when the next timer interrupt will happen */ |
357 | unit = ((-R_TAC) & 3) << 1; | 356 | unit = ((-R_TAC) & 3) << 1; |
358 | cnt = (511 - cpu.tim + (1<<unit)) >> unit; | 357 | cnt = (511 - cpu.tim + (1<<unit)) >> unit; |
diff --git a/apps/plugins/rockboy/lcd.c b/apps/plugins/rockboy/lcd.c index da3b138e51..f62e3a9ce3 100644 --- a/apps/plugins/rockboy/lcd.c +++ b/apps/plugins/rockboy/lcd.c | |||
@@ -64,7 +64,7 @@ fb_data *vdest; | |||
64 | static void updatepatpix(void) ICODE_ATTR; | 64 | static void updatepatpix(void) ICODE_ATTR; |
65 | static void updatepatpix(void) | 65 | static void updatepatpix(void) |
66 | { | 66 | { |
67 | int i, j; | 67 | int i; |
68 | #if ((CONFIG_CPU != SH7034) && !defined(CPU_COLDFIRE)) | 68 | #if ((CONFIG_CPU != SH7034) && !defined(CPU_COLDFIRE)) |
69 | int k, a, c; | 69 | int k, a, c; |
70 | #endif | 70 | #endif |
@@ -73,10 +73,12 @@ static void updatepatpix(void) | |||
73 | if (!anydirty) return; | 73 | if (!anydirty) return; |
74 | for (i = 0; i < 1024; i++) | 74 | for (i = 0; i < 1024; i++) |
75 | { | 75 | { |
76 | int j; | ||
76 | if (i == 384) i = 512; | 77 | if (i == 384) i = 512; |
77 | if (i == 896) break; | 78 | if (i == 896) break; |
78 | if (!patdirty[i]) continue; | 79 | if (!patdirty[i]) continue; |
79 | patdirty[i] = 0; | 80 | patdirty[i] = 0; |
81 | |||
80 | for (j = 0; j < 8; j++) | 82 | for (j = 0; j < 8; j++) |
81 | { | 83 | { |
82 | #if CONFIG_CPU == SH7034 | 84 | #if CONFIG_CPU == SH7034 |
@@ -376,8 +378,8 @@ static void tilebuf(void) | |||
376 | int base; | 378 | int base; |
377 | byte *tilemap, *attrmap; | 379 | byte *tilemap, *attrmap; |
378 | int *tilebuf; | 380 | int *tilebuf; |
379 | int *wrap; | 381 | const int *wrap; |
380 | static int wraptable[64] = | 382 | static const int wraptable[64] ICONST_ATTR = |
381 | { | 383 | { |
382 | 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, | 384 | 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, |
383 | 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,-32 | 385 | 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,-32 |
@@ -778,11 +780,11 @@ static void spr_enum(void) | |||
778 | static void spr_scan(void) ICODE_ATTR; | 780 | static void spr_scan(void) ICODE_ATTR; |
779 | static void spr_scan(void) | 781 | static void spr_scan(void) |
780 | { | 782 | { |
781 | int i, x; | 783 | int i; |
782 | byte pal, b, ns = NS; | 784 | byte ns = NS; |
783 | byte *src, *dest, *bg, *pri; | 785 | byte *src, *dest; |
784 | struct vissprite *vs; | 786 | struct vissprite *vs; |
785 | static byte bgdup[256]; | 787 | static byte bgdup[256] IBSS_ATTR; |
786 | 788 | ||
787 | if (!ns) return; | 789 | if (!ns) return; |
788 | 790 | ||
@@ -791,7 +793,8 @@ static void spr_scan(void) | |||
791 | 793 | ||
792 | for (; ns; ns--, vs--) | 794 | for (; ns; ns--, vs--) |
793 | { | 795 | { |
794 | x = vs->x; | 796 | int x = vs->x; |
797 | |||
795 | if (x > 159) continue; | 798 | if (x > 159) continue; |
796 | if (x < -7) continue; | 799 | if (x < -7) continue; |
797 | if (x < 0) | 800 | if (x < 0) |
@@ -807,23 +810,25 @@ static void spr_scan(void) | |||
807 | if (x > 152) i = 160 - x; | 810 | if (x > 152) i = 160 - x; |
808 | else i = 8; | 811 | else i = 8; |
809 | } | 812 | } |
810 | pal = vs->pal; | 813 | |
814 | byte pal = vs->pal; | ||
815 | |||
811 | if (vs->pri) | 816 | if (vs->pri) |
812 | { | 817 | { |
813 | bg = bgdup + (dest - BUF); | 818 | byte *bg = bgdup + (dest - BUF); |
814 | while (i--) | 819 | while (i--) |
815 | { | 820 | { |
816 | b = src[i]; | 821 | byte b = src[i]; |
817 | if (b && !(bg[i]&3)) dest[i] = pal|b; | 822 | if (b && !(bg[i]&3)) dest[i] = pal|b; |
818 | } | 823 | } |
819 | } | 824 | } |
820 | else if (hw.cgb) | 825 | else if (hw.cgb) |
821 | { | 826 | { |
822 | bg = bgdup + (dest - BUF); | 827 | byte *bg = bgdup + (dest - BUF); |
823 | pri = PRI + (dest - BUF); | 828 | byte *pri = PRI + (dest - BUF); |
824 | while (i--) | 829 | while (i--) |
825 | { | 830 | { |
826 | b = src[i]; | 831 | byte b = src[i]; |
827 | if (b && (!pri[i] || !(bg[i]&3))) | 832 | if (b && (!pri[i] || !(bg[i]&3))) |
828 | dest[i] = pal|b; | 833 | dest[i] = pal|b; |
829 | } | 834 | } |
diff --git a/apps/plugins/rockboy/sound.c b/apps/plugins/rockboy/sound.c index 041b7831d3..c1b06a1bd7 100644 --- a/apps/plugins/rockboy/sound.c +++ b/apps/plugins/rockboy/sound.c | |||
@@ -116,9 +116,6 @@ struct snd snd IBSS_ATTR; | |||
116 | static void gbSoundChannel1(int *r, int *l) | 116 | static void gbSoundChannel1(int *r, int *l) |
117 | { | 117 | { |
118 | int vol = S1.envol; | 118 | int vol = S1.envol; |
119 | |||
120 | int freq = 0; | ||
121 | |||
122 | int value = 0; | 119 | int value = 0; |
123 | 120 | ||
124 | if(S1.on && (S1.len || !S1.cont)) | 121 | if(S1.on && (S1.len || !S1.cont)) |
@@ -172,7 +169,7 @@ static void gbSoundChannel1(int *r, int *l) | |||
172 | 169 | ||
173 | if(S1.swlen<=0) | 170 | if(S1.swlen<=0) |
174 | { | 171 | { |
175 | freq = (((int)(R_NR14&7) << 8) | R_NR13); | 172 | int freq = (((int)(R_NR14&7) << 8) | R_NR13); |
176 | 173 | ||
177 | int updown = 1; | 174 | int updown = 1; |
178 | 175 | ||
diff --git a/bootloader/gigabeat.c b/bootloader/gigabeat.c index 6b3a68be6e..575e61c2fa 100644 --- a/bootloader/gigabeat.c +++ b/bootloader/gigabeat.c | |||
@@ -44,11 +44,29 @@ | |||
44 | #include "rbunicode.h" | 44 | #include "rbunicode.h" |
45 | #include "usb.h" | 45 | #include "usb.h" |
46 | #include "mmu-arm.h" | 46 | #include "mmu-arm.h" |
47 | #include "rtc.h" | ||
47 | 48 | ||
48 | #include <stdarg.h> | 49 | #include <stdarg.h> |
49 | 50 | ||
50 | char version[] = APPSVERSION; | 51 | char version[] = APPSVERSION; |
51 | 52 | ||
53 | void shutdown(void) | ||
54 | { | ||
55 | /* We need to gracefully spin down the disk to prevent clicks. */ | ||
56 | if (ide_powered()) | ||
57 | { | ||
58 | /* Make sure ATA has been initialized. */ | ||
59 | ata_init(); | ||
60 | |||
61 | /* And put the disk into sleep immediately. */ | ||
62 | ata_sleepnow(); | ||
63 | } | ||
64 | |||
65 | _backlight_off(); | ||
66 | |||
67 | power_off(); | ||
68 | } | ||
69 | |||
52 | void main(void) | 70 | void main(void) |
53 | { | 71 | { |
54 | unsigned char* loadbuffer; | 72 | unsigned char* loadbuffer; |
@@ -56,14 +74,67 @@ void main(void) | |||
56 | int rc; | 74 | int rc; |
57 | int(*kernel_entry)(void); | 75 | int(*kernel_entry)(void); |
58 | 76 | ||
59 | power_init(); | ||
60 | system_init(); | 77 | system_init(); |
61 | lcd_init(); | 78 | lcd_init(); |
62 | backlight_init(); | 79 | backlight_init(); |
80 | button_init(); | ||
63 | font_init(); | 81 | font_init(); |
82 | kernel_init(); /* Need the kernel to sleep */ | ||
83 | adc_init(); | ||
64 | 84 | ||
65 | lcd_setfont(FONT_SYSFIXED); | 85 | lcd_setfont(FONT_SYSFIXED); |
86 | |||
87 | if(!(GPGDAT&BUTTON_POWER) && charger_inserted()) | ||
88 | { | ||
89 | while(!(GPGDAT&BUTTON_POWER) && charger_inserted()) | ||
90 | { | ||
91 | char msg[20]; | ||
92 | if(charging_state()) | ||
93 | { | ||
94 | snprintf(msg,sizeof(msg),"Charging"); | ||
95 | } | ||
96 | else | ||
97 | { | ||
98 | snprintf(msg,sizeof(msg),"Charge Complete"); | ||
99 | } | ||
100 | reset_screen(); | ||
101 | lcd_putsxy( (LCD_WIDTH - (SYSFONT_WIDTH * strlen(msg))) / 2, | ||
102 | (LCD_HEIGHT - SYSFONT_HEIGHT) / 2, msg); | ||
103 | lcd_update(); | ||
104 | |||
105 | #if defined(HAVE_RTC_ALARM) | ||
106 | /* Check if the alarm went off while charging */ | ||
107 | if(rtc_check_alarm_flag()) | ||
108 | { | ||
109 | GSTATUS4=1; /* Normally this is set in crt0.s */ | ||
110 | break; | ||
111 | } | ||
112 | #endif | ||
113 | } | ||
114 | if(!(GPGDAT&BUTTON_POWER) | ||
115 | #if defined(HAVE_RTC_ALARM) | ||
116 | && !GSTATUS4 | ||
117 | #endif | ||
118 | ) | ||
119 | { | ||
120 | shutdown(); | ||
121 | } | ||
122 | } | ||
123 | |||
124 | if(button_hold()) | ||
125 | { | ||
126 | const char msg[] = "HOLD is enabled"; | ||
127 | reset_screen(); | ||
128 | lcd_putsxy( (LCD_WIDTH - (SYSFONT_WIDTH * strlen(msg))) / 2, | ||
129 | (LCD_HEIGHT - SYSFONT_HEIGHT) / 2, msg); | ||
130 | lcd_update(); | ||
131 | |||
132 | sleep(2*HZ); | ||
133 | |||
134 | shutdown(); | ||
135 | } | ||
66 | 136 | ||
137 | power_init(); | ||
67 | usb_init(); | 138 | usb_init(); |
68 | 139 | ||
69 | /* Enter USB mode without USB thread */ | 140 | /* Enter USB mode without USB thread */ |
@@ -88,9 +159,7 @@ void main(void) | |||
88 | lcd_update(); | 159 | lcd_update(); |
89 | } | 160 | } |
90 | 161 | ||
91 | kernel_init(); | 162 | reset_screen(); |
92 | adc_init(); | ||
93 | button_init(); | ||
94 | 163 | ||
95 | /* Show debug messages if button is pressed */ | 164 | /* Show debug messages if button is pressed */ |
96 | if(button_read_device()) | 165 | if(button_read_device()) |
diff --git a/firmware/drivers/audio/wm8751.c b/firmware/drivers/audio/wm8751.c index 7145fe4ea4..439d50a5d0 100644 --- a/firmware/drivers/audio/wm8751.c +++ b/firmware/drivers/audio/wm8751.c | |||
@@ -219,6 +219,8 @@ void audiohw_close(void) | |||
219 | /* 2. Disable all output buffers. */ | 219 | /* 2. Disable all output buffers. */ |
220 | wmcodec_write(PWRMGMT2, 0x0); | 220 | wmcodec_write(PWRMGMT2, 0x0); |
221 | 221 | ||
222 | sleep(HZ); | ||
223 | |||
222 | /* 3. Switch off the power supplies. */ | 224 | /* 3. Switch off the power supplies. */ |
223 | wmcodec_write(PWRMGMT1, 0x0); | 225 | wmcodec_write(PWRMGMT1, 0x0); |
224 | } | 226 | } |
diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h index 0c5462400b..a75dbc8a55 100644 --- a/firmware/export/config-gigabeat.h +++ b/firmware/export/config-gigabeat.h | |||
@@ -10,6 +10,9 @@ | |||
10 | /* For Rolo and boot loader */ | 10 | /* For Rolo and boot loader */ |
11 | #define MODEL_NUMBER 18 | 11 | #define MODEL_NUMBER 18 |
12 | 12 | ||
13 | /* Define RTC alarm */ | ||
14 | #define HAVE_RTC_ALARM | ||
15 | |||
13 | /* define this if you use an ATA controller */ | 16 | /* define this if you use an ATA controller */ |
14 | #define CONFIG_STORAGE STORAGE_ATA | 17 | #define CONFIG_STORAGE STORAGE_ATA |
15 | 18 | ||
diff --git a/firmware/target/arm/s3c2440/crt0.S b/firmware/target/arm/s3c2440/crt0.S index ff5eafd042..af0ef5bba8 100644 --- a/firmware/target/arm/s3c2440/crt0.S +++ b/firmware/target/arm/s3c2440/crt0.S | |||
@@ -49,8 +49,8 @@ vectors: | |||
49 | /* Add some strings to detect the bootloader in flash and give it a version | 49 | /* Add some strings to detect the bootloader in flash and give it a version |
50 | * number. (0x040A0028, 0x040A002C) | 50 | * number. (0x040A0028, 0x040A002C) |
51 | */ | 51 | */ |
52 | .string "ROCKBOX" | 52 | .string "ROCKBOX\0" |
53 | .word 0x0001 | 53 | .string "R 03.00\0" |
54 | 54 | ||
55 | /* | 55 | /* |
56 | * Function: word_copy | 56 | * Function: word_copy |
@@ -99,6 +99,18 @@ start: | |||
99 | cmp r0, #0xA0000 | 99 | cmp r0, #0xA0000 |
100 | bne poweron | 100 | bne poweron |
101 | 101 | ||
102 | /* Did an RTC event wake the player up? */ | ||
103 | |||
104 | mov r2, #0x4A000000 | ||
105 | ldr r1, [r2] | ||
106 | ands r1, r1, #0x40000000 | ||
107 | |||
108 | /* Woke up with the alarm - store a flag in GSTATUS3 */ | ||
109 | ldrne r2, =0x560000b8 | ||
110 | movne r1, #0x01 | ||
111 | strne r1, [r2] | ||
112 | bne poweron | ||
113 | |||
102 | /* Set GPG up to read power and menu status */ | 114 | /* Set GPG up to read power and menu status */ |
103 | ldr r2, =0x56000050 | 115 | ldr r2, =0x56000050 |
104 | ldr r1, [r2, #0x18] | 116 | ldr r1, [r2, #0x18] |
diff --git a/firmware/target/arm/s3c2440/debug-s3c2440.c b/firmware/target/arm/s3c2440/debug-s3c2440.c index 97b7123a43..6cd6d649cf 100644 --- a/firmware/target/arm/s3c2440/debug-s3c2440.c +++ b/firmware/target/arm/s3c2440/debug-s3c2440.c | |||
@@ -32,7 +32,44 @@ | |||
32 | 32 | ||
33 | bool __dbg_hw_info(void) | 33 | bool __dbg_hw_info(void) |
34 | { | 34 | { |
35 | return false; | 35 | char buf[50]; |
36 | int line, button; | ||
37 | |||
38 | char reg=0, value=0; | ||
39 | |||
40 | lcd_clear_display(); | ||
41 | lcd_setfont(FONT_SYSFIXED); | ||
42 | |||
43 | while(1) | ||
44 | { | ||
45 | line=0; | ||
46 | snprintf(buf, sizeof(buf), "reg: %08x value: %08x", reg, value); | ||
47 | lcd_puts(0, line++, buf); | ||
48 | |||
49 | button = button_get_w_tmo(HZ/10); | ||
50 | |||
51 | if (button == BUTTON_UP) | ||
52 | reg++; | ||
53 | if (button == BUTTON_DOWN) | ||
54 | reg--; | ||
55 | |||
56 | if (button == BUTTON_VOL_UP) | ||
57 | value++; | ||
58 | if (button == BUTTON_VOL_DOWN) | ||
59 | value--; | ||
60 | |||
61 | if (button == BUTTON_A) | ||
62 | { | ||
63 | // LCD_SPI_start(); | ||
64 | // LCD_SPI_setreg(reg, value); | ||
65 | // LCD_SPI_stop(); | ||
66 | } | ||
67 | |||
68 | lcd_update(); | ||
69 | |||
70 | if (button == (DEBUG_CANCEL|BUTTON_REL)) | ||
71 | return false; | ||
72 | } | ||
36 | } | 73 | } |
37 | 74 | ||
38 | bool __dbg_ports(void) | 75 | bool __dbg_ports(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 ac8dc380e2..e09f628809 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c +++ b/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c | |||
@@ -244,7 +244,7 @@ static void LCD_SPI_init(void) | |||
244 | /* LCD init */ | 244 | /* LCD init */ |
245 | void lcd_init_device(void) | 245 | void lcd_init_device(void) |
246 | { | 246 | { |
247 | #ifdef BOOTLOADER | 247 | #if 0//def BOOTLOADER |
248 | int i; | 248 | int i; |
249 | /* When the Rockbox bootloader starts, we are changing framebuffer address, | 249 | /* When the Rockbox bootloader starts, we are changing framebuffer address, |
250 | but we don't want what's shown on the LCD to change until we do an | 250 | but we don't want what's shown on the LCD to change until we do an |
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/power-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/power-meg-fx.c index 544869ab6c..d625c07cc8 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/power-meg-fx.c +++ b/firmware/target/arm/s3c2440/gigabeat-fx/power-meg-fx.c | |||
@@ -70,6 +70,11 @@ void power_off(void) | |||
70 | _backlight_off(); | 70 | _backlight_off(); |
71 | _buttonlight_off(); | 71 | _buttonlight_off(); |
72 | sleep(HZ); | 72 | sleep(HZ); |
73 | |||
74 | /* Do this to allow the drive to properly reset when player restarts | ||
75 | * immediately without running OF shutdown. | ||
76 | */ | ||
77 | GPGCON&=~0x00300000; | ||
73 | 78 | ||
74 | /* Rockbox never properly shutdown the player. When the sleep bit is set | 79 | /* Rockbox never properly shutdown the player. When the sleep bit is set |
75 | * the player actually wakes up in some type of "zombie" state | 80 | * the player actually wakes up in some type of "zombie" state |
@@ -81,6 +86,122 @@ void power_off(void) | |||
81 | CLKCON |=(1<<3); | 86 | CLKCON |=(1<<3); |
82 | 87 | ||
83 | reboot_point(); | 88 | reboot_point(); |
89 | |||
90 | #if 0 | ||
91 | |||
92 | GPBCON=0x00015450; | ||
93 | GPBDAT=0x403; | ||
94 | GPBUP=0x3FD; | ||
95 | |||
96 | GPCCON =0xAAA054A8; | ||
97 | GPCDAT =0x0000038C; | ||
98 | GPCUP =0xFFFF; | ||
99 | |||
100 | |||
101 | GPDCON =0xAAA0AAA5; | ||
102 | GPDDAT =0x00000300; | ||
103 | GPDUP =0xFCFF; | ||
104 | |||
105 | |||
106 | GPECON =0xAA8002AA; | ||
107 | GPEDAT =0x0000FFED; | ||
108 | GPEUP =0x3817; | ||
109 | |||
110 | GPFCON =0x00000a00; | ||
111 | GPFDAT =0x000000F1; | ||
112 | GPFUP =0x000000FF; | ||
113 | |||
114 | GPGCON =0x01401002; | ||
115 | GPGDAT =0x00000180; | ||
116 | GPGUP =0x0000FF7F; | ||
117 | |||
118 | GPHCON =0x001540A5; | ||
119 | GPHDAT =0x000006FD; | ||
120 | GPHUP =0x00000187; | ||
121 | |||
122 | // mine | ||
123 | INTMSK =0xFFFFFFFF; | ||
124 | EINTMASK=0x0FFFFEF0; | ||
125 | EXTINT0 =0xFFFFFECF; | ||
126 | EXTINT1 =0x07; | ||
127 | // | ||
128 | |||
129 | // INTMSK=0xFFFFFFFF; | ||
130 | // EINTMASK=0x00200000; | ||
131 | |||
132 | // GPHDAT=0x00000004; | ||
133 | |||
134 | // EXTINT0=~0x00000130; | ||
135 | // INTMSK=(~0x00000130)+0x00000100; | ||
136 | // GPGUP=0xFFFFFFFF; | ||
137 | |||
138 | //mine | ||
139 | INTMSK =0xFFFFFFDE; | ||
140 | // | ||
141 | |||
142 | SRCPND=0xFFFFFFFF; | ||
143 | INTPND=0xFFFFFFFF; | ||
144 | GSTATUS1=0x00000600; | ||
145 | |||
146 | ADCCON=0x00000004; | ||
147 | |||
148 | // MISCCR=MISCCR&(~0x703000)|0x603000; | ||
149 | LCDCON1=0x00000000; | ||
150 | LOCKTIME=0xFFFFFFFF; | ||
151 | // REFRESH=REFRESH|0x00400000; | ||
152 | |||
153 | // MISCCR=MISCCR|0x000E0000; | ||
154 | |||
155 | // CLKCON=CLKCON|0x00004018; | ||
156 | |||
157 | /* | ||
158 | * This next piece of code was taken from the linux 2.6.17 sources: | ||
159 | * linux/arch/arm/mach-s3c2410/sleep.S | ||
160 | * | ||
161 | * Copyright (c) 2004 Simtec Electronics | ||
162 | * Ben Dooks <ben@simtec.co.uk> | ||
163 | * | ||
164 | * Based on PXA/SA1100 sleep code by: | ||
165 | * Nicolas Pitre, (c) 2002 Monta Vista Software Inc | ||
166 | * Cliff Brake, (c) 2001 | ||
167 | */ | ||
168 | |||
169 | asm volatile | ||
170 | ( | ||
171 | /* get REFRESH, MISCCR, and CLKCON (and ensure in TLB) */ | ||
172 | "ldr r4, =0x48000024 \n" | ||
173 | "ldr r5, =0x56000080 \n" | ||
174 | "ldr r6, =0x4C00000C \n" | ||
175 | "ldr r7, [ r4 ] \n" | ||
176 | "ldr r8, [ r5 ] \n" | ||
177 | "ldr r9, [ r6 ] \n" | ||
178 | |||
179 | /* Setup register writes */ | ||
180 | "ldr r2, =0x006E3000 \n" | ||
181 | "ldr r3, =0x00004018 \n" | ||
182 | "orr r7, r7, #0x00400000 \n" /* SDRAM sleep command */ | ||
183 | "orr r8, r8, r2 \n" /* SDRAM power-down signals */ | ||
184 | "orr r9, r9, r3 \n" /* power down command */ | ||
185 | |||
186 | /* first as a trial-run to load cache */ | ||
187 | "teq pc, #0 \n" | ||
188 | "bl s3c2410_do_sleep \n" | ||
189 | |||
190 | /* now do it for real */ | ||
191 | "teq r0, r0 \n" | ||
192 | "b s3c2410_do_sleep \n" | ||
193 | |||
194 | /* align next bit of code to cache line */ | ||
195 | ".align 8 \n" | ||
196 | "s3c2410_do_sleep: \n" | ||
197 | "streq r7, [ r4 ] \n" /* SDRAM sleep command */ | ||
198 | "streq r8, [ r5 ] \n" /* SDRAM power-down config */ | ||
199 | "streq r3, [ r6 ] \n" /* CPU sleep */ | ||
200 | "1: \n" | ||
201 | "beq 1b \n" | ||
202 | "bx lr \n" | ||
203 | ); | ||
204 | #endif | ||
84 | } | 205 | } |
85 | 206 | ||
86 | #else /* SIMULATOR */ | 207 | #else /* SIMULATOR */ |
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 8065926e28..96afa9b238 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c +++ b/firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c | |||
@@ -113,9 +113,14 @@ void system_reboot(void) | |||
113 | 113 | ||
114 | static void set_page_tables(void) | 114 | static void set_page_tables(void) |
115 | { | 115 | { |
116 | map_section(0, 0, 0x1000, CACHE_NONE); /* map every memory region to itself */ | 116 | /* map every memory region to itself */ |
117 | map_section(0x30000000, 0, 32, CACHE_ALL); /* map RAM to 0 and enable caching for it */ | 117 | map_section(0, 0, 0x1000, CACHE_NONE); |
118 | map_section((int)FRAME, (int)FRAME, 1, BUFFERED); /* enable buffered writing for the framebuffer */ | 118 | |
119 | /* map RAM to 0 and enable caching for it */ | ||
120 | map_section(0x30000000, 0, 32, CACHE_ALL); | ||
121 | |||
122 | /* enable buffered writing for the framebuffer */ | ||
123 | map_section((int)FRAME, (int)FRAME, 1, BUFFERED); | ||
119 | } | 124 | } |
120 | 125 | ||
121 | void memory_init(void) { | 126 | void memory_init(void) { |
@@ -145,7 +150,7 @@ void s3c_regclr(volatile int *reg, unsigned int mask) | |||
145 | void system_init(void) | 150 | void system_init(void) |
146 | { | 151 | { |
147 | INTMSK = 0xFFFFFFFF; | 152 | INTMSK = 0xFFFFFFFF; |
148 | INTMOD = 0; | 153 | INTMOD = 0; |
149 | SRCPND = 0xFFFFFFFF; | 154 | SRCPND = 0xFFFFFFFF; |
150 | INTPND = 0xFFFFFFFF; | 155 | INTPND = 0xFFFFFFFF; |
151 | INTSUBMSK = 0xFFFFFFFF; | 156 | INTSUBMSK = 0xFFFFFFFF; |