diff options
author | Thom Johansen <thomj@rockbox.org> | 2005-12-10 19:51:56 +0000 |
---|---|---|
committer | Thom Johansen <thomj@rockbox.org> | 2005-12-10 19:51:56 +0000 |
commit | 27cd6ca15243593085341bb4f3c2a4c864d89214 (patch) | |
tree | f91eeac25138db9cb6ceca79f605ade885060b61 | |
parent | 518bf0907d20dfe180f9e2a97a0ab6a2c6e6acb6 (diff) | |
download | rockbox-27cd6ca15243593085341bb4f3c2a4c864d89214.tar.gz rockbox-27cd6ca15243593085341bb4f3c2a4c864d89214.zip |
Make threading code for iPod compile on all ARM CPUs, comment out sleep loop until we have iPod interrupts.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8214 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/thread.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/firmware/thread.c b/firmware/thread.c index 5cd4dbeaf0..7ed8dbde37 100644 --- a/firmware/thread.c +++ b/firmware/thread.c | |||
@@ -41,7 +41,7 @@ struct regs | |||
41 | void *pr; /* Procedure register */ | 41 | void *pr; /* Procedure register */ |
42 | void *start; /* Thread start address, or NULL when started */ | 42 | void *start; /* Thread start address, or NULL when started */ |
43 | }; | 43 | }; |
44 | #elif CONFIG_CPU == PP5020 | 44 | #elif defined(CPU_ARM) |
45 | struct regs | 45 | struct regs |
46 | { | 46 | { |
47 | unsigned int r[9]; /* Registers r4-r12 */ | 47 | unsigned int r[9]; /* Registers r4-r12 */ |
@@ -78,7 +78,7 @@ void switch_thread(void) ICODE_ATTR; | |||
78 | static inline void store_context(void* addr) __attribute__ ((always_inline)); | 78 | static inline void store_context(void* addr) __attribute__ ((always_inline)); |
79 | static inline void load_context(const void* addr) __attribute__ ((always_inline)); | 79 | static inline void load_context(const void* addr) __attribute__ ((always_inline)); |
80 | 80 | ||
81 | #if CONFIG_CPU == PP5020 | 81 | #if defined(CPU_ARM) |
82 | /*--------------------------------------------------------------------------- | 82 | /*--------------------------------------------------------------------------- |
83 | * Store non-volatile context. | 83 | * Store non-volatile context. |
84 | *--------------------------------------------------------------------------- | 84 | *--------------------------------------------------------------------------- |
@@ -86,7 +86,7 @@ static inline void load_context(const void* addr) __attribute__ ((always_inline) | |||
86 | static inline void store_context(void* addr) | 86 | static inline void store_context(void* addr) |
87 | { | 87 | { |
88 | asm volatile( | 88 | asm volatile( |
89 | "stmia %0, { r4-r14 }\n" | 89 | "stmia %0, { r4-r14 } \n" |
90 | : : "r" (addr) | 90 | : : "r" (addr) |
91 | ); | 91 | ); |
92 | } | 92 | } |
@@ -98,12 +98,12 @@ static inline void store_context(void* addr) | |||
98 | static inline void load_context(const void* addr) | 98 | static inline void load_context(const void* addr) |
99 | { | 99 | { |
100 | asm volatile( | 100 | asm volatile( |
101 | "ldmia %0, { r4-r14 } \n" /* load regs r4 to r14 from context */ | 101 | "ldmia %0, { r4-r14 } \n" /* load regs r4 to r14 from context */ |
102 | "ldr r0, [%0, #44] \n" /* load start pointer */ | 102 | "ldr r0, [%0, #44] \n" /* load start pointer */ |
103 | "mov r1, #0 \n" | 103 | "mov r1, #0 \n" |
104 | "cmp r0, r1 \n" /* check for NULL */ | 104 | "cmp r0, r1 \n" /* check for NULL */ |
105 | "strne r1, [%0, #44] \n" /* if it's NULL, we're already running */ | 105 | "strne r1, [%0, #44] \n" /* if it's NULL, we're already running */ |
106 | "movne pc, r0 \n" /* not already running, so jump to start */ | 106 | "movne pc, r0 \n" /* not already running, so jump to start */ |
107 | : : "r" (addr) : "r0", "r1" | 107 | : : "r" (addr) : "r0", "r1" |
108 | ); | 108 | ); |
109 | } | 109 | } |
@@ -251,7 +251,8 @@ void switch_thread(void) | |||
251 | #ifdef SIMULATOR | 251 | #ifdef SIMULATOR |
252 | /* Do nothing */ | 252 | /* Do nothing */ |
253 | #else | 253 | #else |
254 | 254 | /* We currently have no interrupts on iPod targets, so remove this temp. */ | |
255 | #if CONFIG_CPU != PP5020 | ||
255 | while (num_sleepers == num_threads) | 256 | while (num_sleepers == num_threads) |
256 | { | 257 | { |
257 | /* Enter sleep mode, woken up on interrupt */ | 258 | /* Enter sleep mode, woken up on interrupt */ |
@@ -269,7 +270,7 @@ void switch_thread(void) | |||
269 | */ | 270 | */ |
270 | #endif | 271 | #endif |
271 | } | 272 | } |
272 | 273 | #endif | |
273 | #endif | 274 | #endif |
274 | current = current_thread; | 275 | current = current_thread; |
275 | store_context(&thread_contexts[current]); | 276 | store_context(&thread_contexts[current]); |
@@ -376,10 +377,10 @@ void init_threads(void) | |||
376 | thread_name[0] = main_thread_name; | 377 | thread_name[0] = main_thread_name; |
377 | thread_stack[0] = stackbegin; | 378 | thread_stack[0] = stackbegin; |
378 | thread_stack_size[0] = (int)stackend - (int)stackbegin; | 379 | thread_stack_size[0] = (int)stackend - (int)stackbegin; |
379 | #if defined(CPU_COLDFIRE) || (CONFIG_CPU == SH7034) || (CONFIG_CPU == PP5020) | 380 | #if CONFIG_CPU == TCC730 |
380 | thread_contexts[0].start = 0; /* thread 0 already running */ | ||
381 | #elif CONFIG_CPU == TCC730 | ||
382 | thread_contexts[0].started = 1; | 381 | thread_contexts[0].started = 1; |
382 | #else | ||
383 | thread_contexts[0].start = 0; /* thread 0 already running */ | ||
383 | #endif | 384 | #endif |
384 | num_sleepers = 0; | 385 | num_sleepers = 0; |
385 | } | 386 | } |