summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/system.c10
-rw-r--r--firmware/target/arm/system-target.h20
2 files changed, 20 insertions, 10 deletions
diff --git a/firmware/system.c b/firmware/system.c
index 7e7effe67d..921a7d2314 100644
--- a/firmware/system.c
+++ b/firmware/system.c
@@ -276,16 +276,6 @@ void irq(void)
276#endif 276#endif
277#endif /* BOOTLOADER */ 277#endif /* BOOTLOADER */
278 278
279unsigned int current_core(void)
280{
281 if((PROCESSOR_ID & 0xff) == PROC_ID_CPU)
282 {
283 return CPU;
284 }
285 return COP;
286}
287
288
289/* TODO: The following two function have been lifted straight from IPL, and 279/* TODO: The following two function have been lifted straight from IPL, and
290 hence have a lot of numeric addresses used straight. I'd like to use 280 hence have a lot of numeric addresses used straight. I'd like to use
291 #defines for these, but don't know what most of them are for or even what 281 #defines for these, but don't know what most of them are for or even what
diff --git a/firmware/target/arm/system-target.h b/firmware/target/arm/system-target.h
index 2b72e9293e..0dd02a8704 100644
--- a/firmware/target/arm/system-target.h
+++ b/firmware/target/arm/system-target.h
@@ -36,7 +36,27 @@ static inline void udelay(unsigned usecs)
36 while (TIME_BEFORE(USEC_TIMER, stop)); 36 while (TIME_BEFORE(USEC_TIMER, stop));
37} 37}
38 38
39#if CONFIG_CPU == PP5020 || CONFIG_CPU == PP5024
40static inline unsigned int current_core(void)
41{
42 /*
43 * PROCESSOR_ID seems to be 32-bits:
44 * CPU = 0x55555555 = |01010101|01010101|01010101|01010101|
45 * COP = 0xaaaaaaaa = |10101010|10101010|10101010|10101010|
46 * ^
47 */
48 unsigned int core;
49 asm volatile (
50 "ldr %0, =0x60000000 \r\n" /* PROCESSOR_ID */
51 "ldrb %0, [%0] \r\n" /* Just load the LSB */
52 "mov %0, %0, lsr #7 \r\n" /* Bit 7 => index */
53 : "=&r"(core) /* CPU=0, COP=1 */
54 );
55 return core;
56}
57#else
39unsigned int current_core(void); 58unsigned int current_core(void);
59#endif
40 60
41#if CONFIG_CPU != PP5002 61#if CONFIG_CPU != PP5002
42 62