diff options
| author | Miika Pekkarinen <miipekk@ihme.org> | 2007-03-26 16:55:17 +0000 |
|---|---|---|
| committer | Miika Pekkarinen <miipekk@ihme.org> | 2007-03-26 16:55:17 +0000 |
| commit | 66258a30a407e7ea4600fc2242438ecbd084d5ea (patch) | |
| tree | b5fc767011c814a0fde9811731096f11b9f8c9b9 /firmware/export | |
| parent | 6c487eb5d115e77ae31b22f24b692bb2df3b90b6 (diff) | |
| download | rockbox-66258a30a407e7ea4600fc2242438ecbd084d5ea.zip rockbox-66258a30a407e7ea4600fc2242438ecbd084d5ea.tar.gz rockbox-66258a30a407e7ea4600fc2242438ecbd084d5ea.tar.bz2 rockbox-66258a30a407e7ea4600fc2242438ecbd084d5ea.tar.xz | |
Make scheduler functions thread safe core wise. A big step towards playback running on COP (not yet possible because more protection on file system level is necessary).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12926 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
| -rw-r--r-- | firmware/export/kernel.h | 8 | ||||
| -rw-r--r-- | firmware/export/system.h | 2 | ||||
| -rw-r--r-- | firmware/export/thread.h | 24 |
3 files changed, 30 insertions, 4 deletions
diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h index 1d27fed..a77ca31 100644 --- a/firmware/export/kernel.h +++ b/firmware/export/kernel.h @@ -73,6 +73,9 @@ struct event_queue struct thread_entry *thread; unsigned int read; unsigned int write; +#if NUM_CORES > 1 + bool irq_safe; +#endif #ifdef HAVE_EXTENDED_MESSAGING_AND_NAME struct queue_sender_list *send; #endif @@ -105,6 +108,11 @@ int tick_add_task(void (*f)(void)); int tick_remove_task(void (*f)(void)); extern void queue_init(struct event_queue *q, bool register_queue); +#if NUM_CORES > 1 +extern void queue_set_irq_safe(struct event_queue *q, bool state); +#else +#define queue_set_irq_safe(q,state) +#endif extern void queue_delete(struct event_queue *q); extern void queue_wait(struct event_queue *q, struct event *ev); extern void queue_wait_w_tmo(struct event_queue *q, struct event *ev, int ticks); diff --git a/firmware/export/system.h b/firmware/export/system.h index 184e4fe..f5829d7 100644 --- a/firmware/export/system.h +++ b/firmware/export/system.h @@ -58,7 +58,7 @@ bool detect_flashed_ramimage(void); bool detect_original_firmware(void); #if defined(HAVE_ADJUSTABLE_CPU_FREQ) \ - && defined(ROCKBOX_HAS_LOGF) + && defined(ROCKBOX_HAS_LOGF) && (NUM_CORES == 1) #define CPU_BOOST_LOGGING #endif diff --git a/firmware/export/thread.h b/firmware/export/thread.h index 279ea44..0e2ba8e 100644 --- a/firmware/export/thread.h +++ b/firmware/export/thread.h @@ -105,8 +105,11 @@ struct thread_entry { unsigned long statearg; unsigned short stack_size; #ifdef HAVE_PRIORITY_SCHEDULING - unsigned short priority; - unsigned long priority_x; + unsigned char priority; + unsigned char priority_x; +# if NUM_CORES > 1 + unsigned char core; /* To which core threads belongs to. */ +# endif long last_run; #endif struct thread_entry *next, *prev; @@ -116,11 +119,18 @@ struct thread_entry { }; struct core_entry { - struct thread_entry threads[MAXTHREADS]; struct thread_entry *running; struct thread_entry *sleeping; struct thread_entry *waking; struct thread_entry **wakeup_list; +#ifdef HAVE_PRIORITY_SCHEDULING + long highest_priority; +#endif +#if NUM_CORES > 1 + volatile bool lock_issued; + volatile bool kernel_running; +#endif + long last_tick; #ifdef HAVE_EXTENDED_MESSAGING_AND_NAME int switch_to_irq_level; #define STAY_IRQ_LEVEL -1 @@ -171,6 +181,14 @@ struct core_entry { }) #endif +#if NUM_CORES > 1 +inline void lock_cores(void); +inline void unlock_cores(void); +#else +#define lock_cores(...) +#define unlock_cores(...) +#endif + struct thread_entry* create_thread(void (*function)(void), void* stack, int stack_size, const char *name IF_PRIO(, int priority) |