From 5cac9acd3aedc8043d4272d93c56805c46ff6214 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Tue, 1 May 2012 12:20:45 +0200 Subject: Some cleanup ; relocated the kernel at 0xC0000000 --- src/user/lib/include/mutex.h | 15 +++++++++++++++ src/user/lib/include/tce/mem.h | 9 +++++++++ src/user/lib/include/tce/syscall.h | 21 +++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 src/user/lib/include/mutex.h create mode 100644 src/user/lib/include/tce/mem.h create mode 100644 src/user/lib/include/tce/syscall.h (limited to 'src/user/lib/include') diff --git a/src/user/lib/include/mutex.h b/src/user/lib/include/mutex.h new file mode 100644 index 0000000..a6b949b --- /dev/null +++ b/src/user/lib/include/mutex.h @@ -0,0 +1,15 @@ +#ifndef DEF_MUTEX_H +#define DEF_MUTEX_H + +#include + +#define MUTEX_LOCKED 1 +#define MUTEX_UNLOCKED 0 + +//A mutex is just an uint32_t + +void mutex_lock(uint32_t* mutex); //wait for mutex to be free +int mutex_lockE(uint32_t* mutex); //lock mutex only if free, returns !0 if locked, 0 if was busy +void mutex_unlock(uint32_t* mutex); + +#endif diff --git a/src/user/lib/include/tce/mem.h b/src/user/lib/include/tce/mem.h new file mode 100644 index 0000000..ab17bde --- /dev/null +++ b/src/user/lib/include/tce/mem.h @@ -0,0 +1,9 @@ +#ifndef DEF_HEAP_H +#define DEF_HEAP_H + +#include + +void* malloc(size_t size); +void free(void* p); + +#endif diff --git a/src/user/lib/include/tce/syscall.h b/src/user/lib/include/tce/syscall.h new file mode 100644 index 0000000..5257a02 --- /dev/null +++ b/src/user/lib/include/tce/syscall.h @@ -0,0 +1,21 @@ +#ifndef DEF_SYSCALL_H +#define DEF_SYSCALL_H + +#include + +#define NEW_STACK_SIZE 0x8000 + +void thread_exit(); +void schedule(); +void thread_sleep(int time); +void process_exit(int retval); +void printk(char* str); +void thread_new(void (*entry)(void*), void *data); +void irq_wait(int number); +int proc_priv(); + +int proc_setheap(size_t start, size_t end); +int shm_create(size_t offset, size_t length); +int shm_delete(size_t offset); + +#endif -- cgit v1.2.3