diff options
author | Thomas Martitz <kugel@rockbox.org> | 2011-02-19 00:09:08 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2011-02-19 00:09:08 +0000 |
commit | 70bb128ae9b92c23480cd40fa90805eedd0db4bc (patch) | |
tree | 411f39311c375fb5c071cafee3db783dca32c42c /firmware/export | |
parent | 8bc2801e7cb78be60967fefa96a71d4e91761630 (diff) | |
download | rockbox-70bb128ae9b92c23480cd40fa90805eedd0db4bc.tar.gz rockbox-70bb128ae9b92c23480cd40fa90805eedd0db4bc.zip |
Cleanup preprocessor around corelock usage and move its definition outside #ifdef ASSEMBLER_THREADS
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29330 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/thread.h | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/firmware/export/thread.h b/firmware/export/thread.h index ba49951af6..179979a98a 100644 --- a/firmware/export/thread.h +++ b/firmware/export/thread.h | |||
@@ -125,22 +125,6 @@ struct regs | |||
125 | uint32_t start; /* 40 - Thread start address, or NULL when started */ | 125 | uint32_t start; /* 40 - Thread start address, or NULL when started */ |
126 | }; | 126 | }; |
127 | 127 | ||
128 | #ifdef CPU_PP | ||
129 | #ifdef HAVE_CORELOCK_OBJECT | ||
130 | /* No reliable atomic instruction available - use Peterson's algorithm */ | ||
131 | struct corelock | ||
132 | { | ||
133 | volatile unsigned char myl[NUM_CORES]; | ||
134 | volatile unsigned char turn; | ||
135 | } __attribute__((packed)); | ||
136 | |||
137 | /* Too big to inline everywhere */ | ||
138 | void corelock_init(struct corelock *cl); | ||
139 | void corelock_lock(struct corelock *cl); | ||
140 | int corelock_try_lock(struct corelock *cl); | ||
141 | void corelock_unlock(struct corelock *cl); | ||
142 | #endif /* HAVE_CORELOCK_OBJECT */ | ||
143 | #endif /* CPU_PP */ | ||
144 | #elif defined(CPU_MIPS) | 128 | #elif defined(CPU_MIPS) |
145 | struct regs | 129 | struct regs |
146 | { | 130 | { |
@@ -171,6 +155,23 @@ struct regs | |||
171 | #endif | 155 | #endif |
172 | #endif /* PLATFORM_NATIVE */ | 156 | #endif /* PLATFORM_NATIVE */ |
173 | 157 | ||
158 | #ifdef CPU_PP | ||
159 | #ifdef HAVE_CORELOCK_OBJECT | ||
160 | /* No reliable atomic instruction available - use Peterson's algorithm */ | ||
161 | struct corelock | ||
162 | { | ||
163 | volatile unsigned char myl[NUM_CORES]; | ||
164 | volatile unsigned char turn; | ||
165 | } __attribute__((packed)); | ||
166 | |||
167 | /* Too big to inline everywhere */ | ||
168 | void corelock_init(struct corelock *cl); | ||
169 | void corelock_lock(struct corelock *cl); | ||
170 | int corelock_try_lock(struct corelock *cl); | ||
171 | void corelock_unlock(struct corelock *cl); | ||
172 | #endif /* HAVE_CORELOCK_OBJECT */ | ||
173 | #endif /* CPU_PP */ | ||
174 | |||
174 | /* NOTE: The use of the word "queue" may also refer to a linked list of | 175 | /* NOTE: The use of the word "queue" may also refer to a linked list of |
175 | threads being maintained that are normally dealt with in FIFO order | 176 | threads being maintained that are normally dealt with in FIFO order |
176 | and not necessarily kernel event_queue */ | 177 | and not necessarily kernel event_queue */ |
@@ -266,7 +267,7 @@ struct thread_entry | |||
266 | object where thread is blocked - used | 267 | object where thread is blocked - used |
267 | for implicit unblock and explicit wake | 268 | for implicit unblock and explicit wake |
268 | states: STATE_BLOCKED/STATE_BLOCKED_W_TMO */ | 269 | states: STATE_BLOCKED/STATE_BLOCKED_W_TMO */ |
269 | #if NUM_CORES > 1 | 270 | #ifdef HAVE_CORELOCK_OBJECT |
270 | struct corelock *obj_cl; /* Object corelock where thead is blocked - | 271 | struct corelock *obj_cl; /* Object corelock where thead is blocked - |
271 | states: STATE_BLOCKED/STATE_BLOCKED_W_TMO */ | 272 | states: STATE_BLOCKED/STATE_BLOCKED_W_TMO */ |
272 | struct corelock waiter_cl; /* Corelock for thread_wait */ | 273 | struct corelock waiter_cl; /* Corelock for thread_wait */ |
@@ -323,7 +324,7 @@ struct thread_entry | |||
323 | /* Specify current thread in a function taking an ID. */ | 324 | /* Specify current thread in a function taking an ID. */ |
324 | #define THREAD_ID_CURRENT ((unsigned int)-1) | 325 | #define THREAD_ID_CURRENT ((unsigned int)-1) |
325 | 326 | ||
326 | #if NUM_CORES > 1 | 327 | #ifdef HAVE_CORELOCK_OBJECT |
327 | /* Operations to be performed just before stopping a thread and starting | 328 | /* Operations to be performed just before stopping a thread and starting |
328 | a new one if specified before calling switch_thread */ | 329 | a new one if specified before calling switch_thread */ |
329 | enum | 330 | enum |
@@ -356,7 +357,7 @@ struct core_entry | |||
356 | threads */ | 357 | threads */ |
357 | #endif | 358 | #endif |
358 | long next_tmo_check; /* soonest time to check tmo threads */ | 359 | long next_tmo_check; /* soonest time to check tmo threads */ |
359 | #if NUM_CORES > 1 | 360 | #ifdef HAVE_CORELOCK_OBJECT |
360 | struct thread_blk_ops blk_ops; /* operations to perform when | 361 | struct thread_blk_ops blk_ops; /* operations to perform when |
361 | blocking a thread */ | 362 | blocking a thread */ |
362 | struct corelock rtr_cl; /* Lock for rtr list */ | 363 | struct corelock rtr_cl; /* Lock for rtr list */ |