summaryrefslogtreecommitdiff
path: root/firmware/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/thread.c')
-rw-r--r--firmware/thread.c64
1 files changed, 0 insertions, 64 deletions
diff --git a/firmware/thread.c b/firmware/thread.c
index 4094877742..20e2a8c9b9 100644
--- a/firmware/thread.c
+++ b/firmware/thread.c
@@ -186,51 +186,6 @@ static inline void load_context(const void* addr)
186 ); 186 );
187} 187}
188 188
189#elif CONFIG_CPU == TCC730
190/*---------------------------------------------------------------------------
191 * Store non-volatile context.
192 *---------------------------------------------------------------------------
193 */
194#define store_context(addr) \
195 __asm__ volatile ( \
196 "push r0,r1\n\t" \
197 "push r2,r3\n\t" \
198 "push r4,r5\n\t" \
199 "push r6,r7\n\t" \
200 "push a8,a9\n\t" \
201 "push a10,a11\n\t" \
202 "push a12,a13\n\t" \
203 "push a14\n\t" \
204 "ldw @[%0+0], a15\n\t" : : "a" (addr) );
205
206/*---------------------------------------------------------------------------
207 * Load non-volatile context.
208 *---------------------------------------------------------------------------
209 */
210#define load_context(addr) \
211 { \
212 if (!(addr)->started) { \
213 (addr)->started = 1; \
214 __asm__ volatile ( \
215 "ldw a15, @[%0+0]\n\t" \
216 "ldw a14, @[%0+4]\n\t" \
217 "jmp a14\n\t" : : "a" (addr) \
218 ); \
219 } else \
220 __asm__ volatile ( \
221 "ldw a15, @[%0+0]\n\t" \
222 "pop a14\n\t" \
223 "pop a13,a12\n\t" \
224 "pop a11,a10\n\t" \
225 "pop a9,a8\n\t" \
226 "pop r7,r6\n\t" \
227 "pop r5,r4\n\t" \
228 "pop r3,r2\n\t" \
229 "pop r1,r0\n\t" : : "a" (addr) \
230 ); \
231 \
232 }
233
234#endif 189#endif
235 190
236static void add_to_list(struct thread_entry **list, 191static void add_to_list(struct thread_entry **list,
@@ -353,13 +308,6 @@ static inline void sleep_core(void)
353 /* This should sleep the CPU. It appears to wake by itself on 308 /* This should sleep the CPU. It appears to wake by itself on
354 interrupts */ 309 interrupts */
355 CPU_CTL = 0x80000000; 310 CPU_CTL = 0x80000000;
356#elif CONFIG_CPU == TCC730
357 /* Sleep mode is triggered by the SYS instr on CalmRisc16.
358 * Unfortunately, the manual doesn't specify which arg to use.
359 __asm__ volatile ("sys #0x0f");
360 0x1f seems to trigger a reset;
361 0x0f is the only one other argument used by Archos.
362 */
363#elif CONFIG_CPU == S3C2440 311#elif CONFIG_CPU == S3C2440
364 CLKCON |= 2; 312 CLKCON |= 2;
365#endif 313#endif
@@ -430,12 +378,10 @@ void switch_thread(bool save_context, struct thread_entry **blocked_list)
430 { 378 {
431 store_context(&cores[CURRENT_CORE].running->context); 379 store_context(&cores[CURRENT_CORE].running->context);
432 380
433# if CONFIG_CPU != TCC730
434 /* Check if the current thread stack is overflown */ 381 /* Check if the current thread stack is overflown */
435 stackptr = cores[CURRENT_CORE].running->stack; 382 stackptr = cores[CURRENT_CORE].running->stack;
436 if(stackptr[0] != DEADBEEF) 383 if(stackptr[0] != DEADBEEF)
437 panicf("Stkov %s", cores[CURRENT_CORE].running->name); 384 panicf("Stkov %s", cores[CURRENT_CORE].running->name);
438# endif
439 385
440 /* Check if a thread state change has been requested. */ 386 /* Check if a thread state change has been requested. */
441 if (cores[CURRENT_CORE].running->statearg) 387 if (cores[CURRENT_CORE].running->statearg)
@@ -644,14 +590,8 @@ struct thread_entry*
644 add_to_list(&cores[core].running, thread); 590 add_to_list(&cores[core].running, thread);
645 591
646 regs = &thread->context; 592 regs = &thread->context;
647#if defined(CPU_COLDFIRE) || (CONFIG_CPU == SH7034) || defined(CPU_ARM)
648 /* Align stack to an even 32 bit boundary */ 593 /* Align stack to an even 32 bit boundary */
649 regs->sp = (void*)(((unsigned int)stack + stack_size) & ~3); 594 regs->sp = (void*)(((unsigned int)stack + stack_size) & ~3);
650#elif CONFIG_CPU == TCC730
651 /* Align stack on word boundary */
652 regs->sp = (void*)(((unsigned long)stack + stack_size - 2) & ~1);
653 regs->started = 0;
654#endif
655 regs->start = (void*)function; 595 regs->start = (void*)function;
656 596
657 return thread; 597 return thread;
@@ -751,11 +691,7 @@ void init_threads(void)
751 cores[COP].threads[0].stack_size = (int)cop_stackend - (int)cop_stackbegin; 691 cores[COP].threads[0].stack_size = (int)cop_stackend - (int)cop_stackbegin;
752#endif 692#endif
753 } 693 }
754#if CONFIG_CPU == TCC730
755 cores[core].threads[0].context.started = 1;
756#else
757 cores[core].threads[0].context.start = 0; /* thread 0 already running */ 694 cores[core].threads[0].context.start = 0; /* thread 0 already running */
758#endif
759} 695}
760 696
761int thread_stack_usage(const struct thread_entry *thread) 697int thread_stack_usage(const struct thread_entry *thread)