From dee43ece2086e15894934b754e47cb7ce5882cda Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Fri, 9 Mar 2007 08:03:18 +0000 Subject: Put an end to priority inversion in the ata driver. Gave up trying to have fully atomic dual use mutexes so just replaced the ata driver locking with spins. Maybe I'll have better luck later. Things should run smoothly with database updates and such happening in the background. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12688 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/kernel.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'firmware/export/kernel.h') diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h index ec8aa28a08..495e558175 100644 --- a/firmware/export/kernel.h +++ b/firmware/export/kernel.h @@ -83,10 +83,14 @@ struct event_queue #endif }; +#define MTX_UNOWNED 0x00000000 +#define MTX_BLOCKED_WAITER 0x00000001 +#define MTX_SPIN_WAITER 0x00010001 +#define MTX_SPIN_OWNER 0x00020001 struct mutex { + uint32_t locked; struct thread_entry *thread; - bool locked; }; /* global tick variable */ @@ -126,8 +130,12 @@ extern void queue_remove_from_head(struct event_queue *q, long id); extern int queue_broadcast(long id, intptr_t data); extern void mutex_init(struct mutex *m); +static inline void spinlock_init(struct mutex *m) +{ mutex_init(m); } /* Same thing for now */ extern void mutex_lock(struct mutex *m); extern void mutex_unlock(struct mutex *m); +extern void spinlock_lock(struct mutex *m); +extern void spinlock_unlock(struct mutex *m); extern void tick_start(unsigned int interval_in_ms); #define IS_SYSEVENT(ev) ((ev & SYS_EVENT) == SYS_EVENT) -- cgit v1.2.3