summaryrefslogtreecommitdiff
path: root/firmware/thread.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-08-02 20:34:47 +0000
committerThomas Martitz <kugel@rockbox.org>2010-08-02 20:34:47 +0000
commit240923a801382c86545d10be167a15892a556fb6 (patch)
tree3c0e07ec3abf0c493a0b24b0b57e8bbd0200f7f6 /firmware/thread.c
parent850efead04f10488b478a0f255a2464a01156a7f (diff)
downloadrockbox-240923a801382c86545d10be167a15892a556fb6.tar.gz
rockbox-240923a801382c86545d10be167a15892a556fb6.zip
Rockbox as an application: Commit current Android port progress.
General state is: Rockbox is usable (plays music, saves configuration, touchscreen works too). Problems: - Playing music in the background (i.e. when switching to another app) doesn't work reliably, but I'm working on that now. - no cabbiev2 (only some preliminary files for it), no other default theme. - screen flickers sometimes if the updates are too frequent - no multi screen apk/package - strange behavior when a phone call comes in The java files (and the eclipse project) resides in android/, which is also supposed to be the build folder. I've put a small README in there for instructions. There are some steps needed after the make part, which are described there, and which eclipse mostly handles. But there ought to be some script/makefile rules which do that instead in the future. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27668 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/thread.c')
-rw-r--r--firmware/thread.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/firmware/thread.c b/firmware/thread.c
index c00fc36e3f..b3d8ec3970 100644
--- a/firmware/thread.c
+++ b/firmware/thread.c
@@ -123,8 +123,13 @@ static struct core_entry cores[NUM_CORES] IBSS_ATTR;
123struct thread_entry threads[MAXTHREADS] IBSS_ATTR; 123struct thread_entry threads[MAXTHREADS] IBSS_ATTR;
124 124
125static const char main_thread_name[] = "main"; 125static const char main_thread_name[] = "main";
126#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
126extern uintptr_t stackbegin[]; 127extern uintptr_t stackbegin[];
127extern uintptr_t stackend[]; 128extern uintptr_t stackend[];
129#else
130extern uintptr_t *stackbegin;
131extern uintptr_t *stackend;
132#endif
128 133
129static inline void core_sleep(IF_COP_VOID(unsigned int core)) 134static inline void core_sleep(IF_COP_VOID(unsigned int core))
130 __attribute__((always_inline)); 135 __attribute__((always_inline));
@@ -170,7 +175,9 @@ void switch_thread(void)
170/**************************************************************************** 175/****************************************************************************
171 * Processor-specific section - include necessary core support 176 * Processor-specific section - include necessary core support
172 */ 177 */
173#if defined(CPU_ARM) 178#if defined(ANDROID)
179#include "thread-android-arm.c"
180#elif defined(CPU_ARM)
174#include "thread-arm.c" 181#include "thread-arm.c"
175#if defined (CPU_PP) 182#if defined (CPU_PP)
176#include "thread-pp.c" 183#include "thread-pp.c"
@@ -1150,7 +1157,7 @@ void switch_thread(void)
1150 store_context(&thread->context); 1157 store_context(&thread->context);
1151 1158
1152 /* Check if the current thread stack is overflown */ 1159 /* Check if the current thread stack is overflown */
1153 if (UNLIKELY(thread->stack[0] != DEADBEEF)) 1160 if (UNLIKELY(thread->stack[0] != DEADBEEF) && thread->stack_size > 0)
1154 thread_stkov(thread); 1161 thread_stkov(thread);
1155 1162
1156#if NUM_CORES > 1 1163#if NUM_CORES > 1
@@ -2319,7 +2326,9 @@ static int stack_usage(uintptr_t *stackptr, size_t stack_size)
2319 */ 2326 */
2320int thread_stack_usage(const struct thread_entry *thread) 2327int thread_stack_usage(const struct thread_entry *thread)
2321{ 2328{
2322 return stack_usage(thread->stack, thread->stack_size); 2329 if (LIKELY(thread->stack_size > 0))
2330 return stack_usage(thread->stack, thread->stack_size);
2331 return 0;
2323} 2332}
2324 2333
2325#if NUM_CORES > 1 2334#if NUM_CORES > 1