Rev 2085 | Rev 2093 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2085 | Rev 2089 | ||
---|---|---|---|
Line 34... | Line 34... | ||
34 | 34 | ||
35 | #ifndef KERN_SPINLOCK_H_ |
35 | #ifndef KERN_SPINLOCK_H_ |
36 | #define KERN_SPINLOCK_H_ |
36 | #define KERN_SPINLOCK_H_ |
37 | 37 | ||
38 | #include <arch/types.h> |
38 | #include <arch/types.h> |
39 | #include <typedefs.h> |
- | |
40 | #include <preemption.h> |
39 | #include <preemption.h> |
41 | #include <atomic.h> |
40 | #include <atomic.h> |
42 | #include <debug.h> |
41 | #include <debug.h> |
43 | 42 | ||
44 | #ifdef CONFIG_SMP |
43 | #ifdef CONFIG_SMP |
Line 95... | Line 94... | ||
95 | /* |
94 | /* |
96 | * Prevent critical section code from bleeding out this way down. |
95 | * Prevent critical section code from bleeding out this way down. |
97 | */ |
96 | */ |
98 | CS_LEAVE_BARRIER(); |
97 | CS_LEAVE_BARRIER(); |
99 | 98 | ||
100 | atomic_set(&sl->val,0); |
99 | atomic_set(&sl->val, 0); |
101 | preemption_enable(); |
100 | preemption_enable(); |
102 | } |
101 | } |
103 | 102 | ||
104 | #else |
103 | #else |
105 | 104 | ||
Line 107... | Line 106... | ||
107 | 106 | ||
108 | /* On UP systems, spinlocks are effectively left out. */ |
107 | /* On UP systems, spinlocks are effectively left out. */ |
109 | #define SPINLOCK_DECLARE(name) |
108 | #define SPINLOCK_DECLARE(name) |
110 | #define SPINLOCK_INITIALIZE(name) |
109 | #define SPINLOCK_INITIALIZE(name) |
111 | 110 | ||
112 | #define spinlock_initialize(x,name) |
111 | #define spinlock_initialize(x, name) |
113 | #define spinlock_lock(x) preemption_disable() |
112 | #define spinlock_lock(x) preemption_disable() |
114 | #define spinlock_trylock(x) (preemption_disable(), 1) |
113 | #define spinlock_trylock(x) (preemption_disable(), 1) |
115 | #define spinlock_unlock(x) preemption_enable() |
114 | #define spinlock_unlock(x) preemption_enable() |
116 | 115 | ||
117 | #endif |
116 | #endif |