proc_p.h

Go to the documentation of this file.
00001 
00041 #ifndef KERN_PROC_P_H
00042 #define KERN_PROC_P_H
00043 
00044 #include <cfg/compiler.h>
00045 #include <cpu/types.h>        /* for cpu_stack_t */
00046 #include <mware/list.h>
00047 #include <config_kern.h>
00048 #include <appconfig.h>
00049 
00050 typedef struct Process
00051 {
00052     Node         link;        
00053     cpustack_t  *stack;       
00054     iptr_t       user_data;   
00056 #if CONFIG_KERN_SIGNALS
00057     sigmask_t    sig_wait;    
00058     sigmask_t    sig_recv;    
00059 #endif
00060 
00061 #if CONFIG_KERN_PREEMPTIVE
00062     int          forbid_cnt;  
00063 #endif
00064 
00065 #if CONFIG_KERN_HEAP
00066     uint16_t     flags;       
00067     cpustack_t  *stack_base;  
00068     size_t       stack_size;  
00069 #endif
00070 
00071 #if CONFIG_KERN_MONITOR
00072     struct ProcMonitor
00073     {
00074         Node        link;
00075         const char *name;
00076         cpustack_t *stack_base;
00077         size_t      stack_size;
00078     } monitor;
00079 #endif
00080 
00081 } Process;
00082 
00083 
00088 #define PF_FREESTACK  BV(0)  
00089 /*\}*/
00090 
00091 
00093 extern REGISTER Process *CurrentProcess;
00094 
00096 extern REGISTER List     ProcReadyList;
00097 
00098 
00100 #define SCHED_ENQUEUE(proc)  ADDTAIL(&ProcReadyList, &(proc)->link)
00101 
00103 void proc_schedule(void);
00104 
00105 #if CONFIG_KERN_MONITOR
00106 
00107     void monitor_init(void);
00108 
00110     void monitor_add(Process *proc, const char *name, cpustack_t *stack, size_t stacksize);
00111 
00113     void monitor_remove(Process *proc);
00114 
00116     void monitor_rename(Process *proc, const char* name);
00117 #endif /* CONFIG_KERN_MONITOR */
00118 
00119 #endif /* KERN_PROC_P_H */
00120