forked from len0rd/rockbox
Add CPU-model-specific init to newborn threads. Add default %macsr for each thread created on coldfire (EMAC_FRACTIONAL | EMAC_SATURATE).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12483 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f5184f34bf
commit
2c9cbc12e1
2 changed files with 20 additions and 5 deletions
|
@ -234,16 +234,13 @@ void (* const vbr[]) (void) __attribute__ ((section (".vectors"))) =
|
|||
void system_init(void)
|
||||
{
|
||||
/* Clear the accumulators. From here on it's the responsibility of
|
||||
whoever uses them to clear them after use (use movclr instruction). */
|
||||
whoever uses them to clear them after use and before giving control
|
||||
to "foreign" code (use movclr instruction). */
|
||||
asm volatile ("movclr.l %%acc0, %%d0\n\t"
|
||||
"movclr.l %%acc1, %%d0\n\t"
|
||||
"movclr.l %%acc2, %%d0\n\t"
|
||||
"movclr.l %%acc3, %%d0\n\t"
|
||||
: : : "d0");
|
||||
/* Set EMAC unit to fractional mode with saturation, since that's
|
||||
what'll be the most useful for most things which the main thread
|
||||
will do. */
|
||||
coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE);
|
||||
|
||||
/* Set INTBASE and SPURVEC */
|
||||
INTBASE = 64;
|
||||
|
|
|
@ -141,6 +141,13 @@ static inline void load_context(const void* addr)
|
|||
);
|
||||
}
|
||||
|
||||
/* Set EMAC unit to fractional mode with saturation for each new thread,
|
||||
since that's what'll be the most useful for most things which the dsp
|
||||
will do. Codecs should still initialize their preferred modes
|
||||
explicitly. */
|
||||
#define THREAD_CPU_INIT(core, thread) \
|
||||
({ (thread)->context.macsr = EMAC_FRACTIONAL | EMAC_SATURATE; })
|
||||
|
||||
#elif CONFIG_CPU == SH7034
|
||||
/*---------------------------------------------------------------------------
|
||||
* Store non-volatile context.
|
||||
|
@ -193,6 +200,11 @@ static inline void load_context(const void* addr)
|
|||
|
||||
#endif
|
||||
|
||||
#ifndef THREAD_CPU_INIT
|
||||
/* No cpu specific init - make empty */
|
||||
#define THREAD_CPU_INIT(core, thread)
|
||||
#endif
|
||||
|
||||
static void add_to_list(struct thread_entry **list, struct thread_entry *thread)
|
||||
{
|
||||
if (*list == NULL)
|
||||
|
@ -660,6 +672,10 @@ struct thread_entry*
|
|||
regs->sp = (void*)(((unsigned int)stack + stack_size) & ~3);
|
||||
regs->start = (void*)function;
|
||||
|
||||
/* Do any CPU specific inits after initializing common items
|
||||
to have access to valid data */
|
||||
THREAD_CPU_INIT(core, thread);
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
||||
|
@ -753,10 +769,12 @@ void init_threads(void)
|
|||
* probably a much better way to do this. */
|
||||
if (core == CPU)
|
||||
{
|
||||
THREAD_CPU_INIT(core, &cores[CPU].threads[0]);
|
||||
cores[CPU].threads[0].stack = stackbegin;
|
||||
cores[CPU].threads[0].stack_size = (int)stackend - (int)stackbegin;
|
||||
} else {
|
||||
#if NUM_CORES > 1 /* This code path will not be run on single core targets */
|
||||
THREAD_CPU_INIT(core, &cores[COP].threads[0]);
|
||||
cores[COP].threads[0].stack = cop_stackbegin;
|
||||
cores[COP].threads[0].stack_size =
|
||||
(int)cop_stackend - (int)cop_stackbegin;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue