proc.h

Go to the documentation of this file.
00001 
00040 #ifndef KERN_PROC_H
00041 #define KERN_PROC_H
00042 
00043 #include <cfg/compiler.h>
00044 #include <cpu/irq.h>
00045 #include <config_kern.h>
00046 
00047 /* Fwd decl */
00048 struct Process;
00049 
00050 /* Task scheduling services */
00051 void proc_init(void);
00052 struct Process *proc_new_with_name(const char* name, void (*entry)(void), iptr_t data, size_t stacksize, cpustack_t *stack);
00053 
00054 #if !CONFIG_KERN_MONITOR
00055     #define proc_new(entry,data,size,stack) proc_new_with_name(NULL,(entry),(data),(size),(stack))
00056 #else
00057     #define proc_new(entry,data,size,stack) proc_new_with_name(#entry,(entry),(data),(size),(stack))
00058 #endif
00059 
00060 void proc_exit(void);
00061 void proc_switch(void);
00062 void proc_test(void);
00063 struct Process *proc_current(void);
00064 iptr_t proc_current_user_data(void);
00065 void proc_rename(struct Process *proc, const char* name);
00066 
00067 #if CONFIG_KERN_PREEMPTIVE
00068     void proc_forbid(void);
00069     void proc_permit(void);
00070 #else
00071     INLINE void proc_forbid(void) { /* nop */ }
00072     INLINE void proc_permit(void) { /* nop */ }
00073 #endif
00074 
00078 #define PROC_ATOMIC(CODE) \
00079     do { \
00080         proc_forbid(); \
00081         CODE; \
00082         proc_permit(); \
00083     } while(0)
00084 
00085 #endif /* KERN_PROC_H */