aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/cpu.h2
-rw-r--r--include/util/lock.h12
-rw-r--r--include/util/mutex.h6
3 files changed, 18 insertions, 2 deletions
diff --git a/include/cpu.h b/include/cpu.h
index c200016..6dbaa74 100644
--- a/include/cpu.h
+++ b/include/cpu.h
@@ -91,5 +91,7 @@ static inline void* getirqstack(void)
#define SYS_TIME 1
#define SYS_SCHED 2
#define SYS_FREE_STACK 3
+#define SYS_LOCK 4
+#define SYS_UNLOCK 5
#endif
diff --git a/include/util/lock.h b/include/util/lock.h
new file mode 100644
index 0000000..78add88
--- /dev/null
+++ b/include/util/lock.h
@@ -0,0 +1,12 @@
+#ifndef UTIL_LOCK_H
+#define UTIL_LOCK_H
+
+#include <util/mutex.h>
+
+struct Lock {
+ unsigned long pid;
+} __attribute__((packed, aligned(4)));
+
+struct Lock* create_lock(void);
+
+#endif
diff --git a/include/util/mutex.h b/include/util/mutex.h
index 907fe5b..61237b8 100644
--- a/include/util/mutex.h
+++ b/include/util/mutex.h
@@ -8,10 +8,12 @@
#define CORE3_PID 4
#define FIRST_AVAIL_PID CORE3_PID+1
+// PID field is first so that it can be treated
+// as a lock
struct Mutex {
- void* addr;
unsigned long pid;
-} __attribute__((packed, aligned(4)));;
+ void* addr;
+} __attribute__((packed, aligned(4)));
struct Mutex* create_mutex(void* addr);