Rev 1 | Rev 430 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 223 | ||
---|---|---|---|
Line 29... | Line 29... | ||
29 | #ifndef __SPINLOCK_H__ |
29 | #ifndef __SPINLOCK_H__ |
30 | #define __SPINLOCK_H__ |
30 | #define __SPINLOCK_H__ |
31 | 31 | ||
32 | #include <arch/types.h> |
32 | #include <arch/types.h> |
33 | #include <typedefs.h> |
33 | #include <typedefs.h> |
- | 34 | #include <preemption.h> |
|
34 | 35 | ||
35 | #ifdef __SMP__ |
36 | #ifdef __SMP__ |
36 | struct spinlock { |
37 | struct spinlock { |
37 | int val; |
38 | int val; |
38 | }; |
39 | }; |
Line 46... | Line 47... | ||
46 | 47 | ||
47 | struct spinlock { |
48 | struct spinlock { |
48 | }; |
49 | }; |
49 | 50 | ||
50 | #define spinlock_initialize(x) |
51 | #define spinlock_initialize(x) |
51 | #define spinlock_lock(x) |
52 | #define spinlock_lock(x) preemption_disable() |
52 | #define spinlock_trylock(x) 1 |
53 | #define spinlock_trylock(x) (preemption_disable(), 1) |
53 | #define spinlock_unlock(x) |
54 | #define spinlock_unlock(x) preemption_enable() |
54 | 55 | ||
55 | #endif |
56 | #endif |
56 | 57 | ||
57 | #endif |
58 | #endif |