diff options
author | Torne Wuff <torne@wolfpuppy.org.uk> | 2010-08-29 13:20:16 +0000 |
---|---|---|
committer | Torne Wuff <torne@wolfpuppy.org.uk> | 2010-08-29 13:20:16 +0000 |
commit | 8aa175bc1fd303bccd491fc92689f29bdf439094 (patch) | |
tree | 6e907019503dcd5ae01de1c0ae796c7b704e8a41 | |
parent | 47c510b9dcb0580d9db6199696d0d81ce680b999 (diff) | |
download | rockbox-8aa175bc1fd303bccd491fc92689f29bdf439094.tar.gz rockbox-8aa175bc1fd303bccd491fc92689f29bdf439094.zip |
ipodvideo: detect ram size at boot (doesn't actually get USED yet)
This is the first step to allowing a single build which will work on any ipodvideo.
A global variable, probed_ramsize, is initialised to either 32 or 64 early in boot.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27937 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/target/arm/crt0-pp.S | 18 | ||||
-rw-r--r-- | firmware/target/arm/system-pp502x.c | 11 | ||||
-rw-r--r-- | firmware/target/arm/system-target.h | 4 |
3 files changed, 33 insertions, 0 deletions
diff --git a/firmware/target/arm/crt0-pp.S b/firmware/target/arm/crt0-pp.S index ee95ac8899..585455f821 100644 --- a/firmware/target/arm/crt0-pp.S +++ b/firmware/target/arm/crt0-pp.S | |||
@@ -137,6 +137,24 @@ pad_skip: | |||
137 | mov r1, #0 | 137 | mov r1, #0 |
138 | str r1, [r2] | 138 | str r1, [r2] |
139 | 139 | ||
140 | #if defined(IPOD_VIDEO) | ||
141 | /* detect 32mb vs 64mb model */ | ||
142 | /* we do this here because after SDRAM is remapped, we already assumed */ | ||
143 | /* its size to be whatever we were compiled for. */ | ||
144 | |||
145 | mov r2, #0x12000000 | ||
146 | mov r3, #64 | ||
147 | strb r3, [r2, #-1] /* first write 64 to last byte of first 32MB bank */ | ||
148 | |||
149 | mov r2, #0x14000000 | ||
150 | mov r3, #32 | ||
151 | strb r3, [r2, #-1] /* now write 32 to last byte of second 32MB bank */ | ||
152 | |||
153 | /* now the last word of the first 32MB bank tells you the RAM size */ | ||
154 | /* since on a 32MB model both writes will touch the same actual location */ | ||
155 | /* this is read later on in boot */ | ||
156 | #endif | ||
157 | |||
140 | mov r2, #0x40000000 | 158 | mov r2, #0x40000000 |
141 | ldr r3, =remap_start | 159 | ldr r3, =remap_start |
142 | ldr r4, =remap_end | 160 | ldr r4, =remap_end |
diff --git a/firmware/target/arm/system-pp502x.c b/firmware/target/arm/system-pp502x.c index 9bedb0e42c..700686b427 100644 --- a/firmware/target/arm/system-pp502x.c +++ b/firmware/target/arm/system-pp502x.c | |||
@@ -42,6 +42,10 @@ extern void SERIAL0(void); | |||
42 | static struct corelock cpufreq_cl SHAREDBSS_ATTR; | 42 | static struct corelock cpufreq_cl SHAREDBSS_ATTR; |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | #if defined(IPOD_VIDEO) && !defined(BOOTLOADER) | ||
46 | unsigned char probed_ramsize; | ||
47 | #endif | ||
48 | |||
45 | void __attribute__((interrupt("IRQ"))) irq_handler(void) | 49 | void __attribute__((interrupt("IRQ"))) irq_handler(void) |
46 | { | 50 | { |
47 | if(CURRENT_CORE == CPU) | 51 | if(CURRENT_CORE == CPU) |
@@ -518,6 +522,13 @@ void system_init(void) | |||
518 | #else | 522 | #else |
519 | pp_set_cpu_frequency(CPUFREQ_MAX); | 523 | pp_set_cpu_frequency(CPUFREQ_MAX); |
520 | #endif | 524 | #endif |
525 | |||
526 | #if defined(IPOD_VIDEO) | ||
527 | /* crt0-pp.S wrote the ram size to the last byte of the first 32MB | ||
528 | ram bank. See the comment there for how we determine it. */ | ||
529 | volatile unsigned char *end32 = (volatile unsigned char *)0x01ffffff; | ||
530 | probed_ramsize = *end32; | ||
531 | #endif | ||
521 | } | 532 | } |
522 | 533 | ||
523 | init_cache(); | 534 | init_cache(); |
diff --git a/firmware/target/arm/system-target.h b/firmware/target/arm/system-target.h index 5d20c397f8..c7503d7bcb 100644 --- a/firmware/target/arm/system-target.h +++ b/firmware/target/arm/system-target.h | |||
@@ -172,6 +172,10 @@ static inline void wake_core(int core) | |||
172 | #define HAVE_CPUCACHE_FLUSH | 172 | #define HAVE_CPUCACHE_FLUSH |
173 | #endif | 173 | #endif |
174 | 174 | ||
175 | #if defined(IPOD_VIDEO) && !defined(BOOTLOADER) | ||
176 | extern unsigned char probed_ramsize; | ||
177 | #endif | ||
178 | |||
175 | #endif /* CPU_PP */ | 179 | #endif /* CPU_PP */ |
176 | 180 | ||
177 | #endif /* SYSTEM_TARGET_H */ | 181 | #endif /* SYSTEM_TARGET_H */ |