diff options
| author | Michael Sevakis <jethead71@rockbox.org> | 2007-02-25 21:43:10 +0000 |
|---|---|---|
| committer | Michael Sevakis <jethead71@rockbox.org> | 2007-02-25 21:43:10 +0000 |
| commit | 2c9cbc12e137b1c756721a8fc4df6003032b0b53 (patch) | |
| tree | a9ac372f2cf28287deaa17a786e4bba9be339263 /firmware/thread.c | |
| parent | f5184f34bfd794884d18057a594e7acb9aeb00e4 (diff) | |
| download | rockbox-2c9cbc12e137b1c756721a8fc4df6003032b0b53.zip rockbox-2c9cbc12e137b1c756721a8fc4df6003032b0b53.tar.gz rockbox-2c9cbc12e137b1c756721a8fc4df6003032b0b53.tar.bz2 rockbox-2c9cbc12e137b1c756721a8fc4df6003032b0b53.tar.xz | |
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
Diffstat (limited to 'firmware/thread.c')
| -rw-r--r-- | firmware/thread.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/firmware/thread.c b/firmware/thread.c index 6a583a4..05325bb 100644 --- a/firmware/thread.c +++ b/firmware/thread.c @@ -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; |