diff options
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 6a583a470a..05325bb341 100644 --- a/firmware/thread.c +++ b/firmware/thread.c | |||
@@ -141,6 +141,13 @@ static inline void load_context(const void* addr) | |||
141 | ); | 141 | ); |
142 | } | 142 | } |
143 | 143 | ||
144 | /* Set EMAC unit to fractional mode with saturation for each new thread, | ||
145 | since that's what'll be the most useful for most things which the dsp | ||
146 | will do. Codecs should still initialize their preferred modes | ||
147 | explicitly. */ | ||
148 | #define THREAD_CPU_INIT(core, thread) \ | ||
149 | ({ (thread)->context.macsr = EMAC_FRACTIONAL | EMAC_SATURATE; }) | ||
150 | |||
144 | #elif CONFIG_CPU == SH7034 | 151 | #elif CONFIG_CPU == SH7034 |
145 | /*--------------------------------------------------------------------------- | 152 | /*--------------------------------------------------------------------------- |
146 | * Store non-volatile context. | 153 | * Store non-volatile context. |
@@ -193,6 +200,11 @@ static inline void load_context(const void* addr) | |||
193 | 200 | ||
194 | #endif | 201 | #endif |
195 | 202 | ||
203 | #ifndef THREAD_CPU_INIT | ||
204 | /* No cpu specific init - make empty */ | ||
205 | #define THREAD_CPU_INIT(core, thread) | ||
206 | #endif | ||
207 | |||
196 | static void add_to_list(struct thread_entry **list, struct thread_entry *thread) | 208 | static void add_to_list(struct thread_entry **list, struct thread_entry *thread) |
197 | { | 209 | { |
198 | if (*list == NULL) | 210 | if (*list == NULL) |
@@ -660,6 +672,10 @@ struct thread_entry* | |||
660 | regs->sp = (void*)(((unsigned int)stack + stack_size) & ~3); | 672 | regs->sp = (void*)(((unsigned int)stack + stack_size) & ~3); |
661 | regs->start = (void*)function; | 673 | regs->start = (void*)function; |
662 | 674 | ||
675 | /* Do any CPU specific inits after initializing common items | ||
676 | to have access to valid data */ | ||
677 | THREAD_CPU_INIT(core, thread); | ||
678 | |||
663 | return thread; | 679 | return thread; |
664 | } | 680 | } |
665 | 681 | ||
@@ -753,10 +769,12 @@ void init_threads(void) | |||
753 | * probably a much better way to do this. */ | 769 | * probably a much better way to do this. */ |
754 | if (core == CPU) | 770 | if (core == CPU) |
755 | { | 771 | { |
772 | THREAD_CPU_INIT(core, &cores[CPU].threads[0]); | ||
756 | cores[CPU].threads[0].stack = stackbegin; | 773 | cores[CPU].threads[0].stack = stackbegin; |
757 | cores[CPU].threads[0].stack_size = (int)stackend - (int)stackbegin; | 774 | cores[CPU].threads[0].stack_size = (int)stackend - (int)stackbegin; |
758 | } else { | 775 | } else { |
759 | #if NUM_CORES > 1 /* This code path will not be run on single core targets */ | 776 | #if NUM_CORES > 1 /* This code path will not be run on single core targets */ |
777 | THREAD_CPU_INIT(core, &cores[COP].threads[0]); | ||
760 | cores[COP].threads[0].stack = cop_stackbegin; | 778 | cores[COP].threads[0].stack = cop_stackbegin; |
761 | cores[COP].threads[0].stack_size = | 779 | cores[COP].threads[0].stack_size = |
762 | (int)cop_stackend - (int)cop_stackbegin; | 780 | (int)cop_stackend - (int)cop_stackbegin; |