voron

experimental ARM OS
git clone git://git.2f30.org/voron
Log | Files | Refs | README | LICENSE

sched.h (900B)


      1 #ifndef __SCHED_H
      2 #define __SCHED_H
      3 
      4 #include <kernel.h>
      5 #include <list.h>
      6 
      7 /* scheduler interval in milliseconds */
      8 #define SCHED_INT_MS	10
      9 
     10 typedef u32 pid_t;
     11 
     12 typedef enum {
     13 	TASK_TERMINATE,
     14 	TASK_RUNNABLE,
     15 	TASK_RUNNING,
     16 	TASK_SLEEPING
     17 } task_state_t;
     18 
     19 typedef enum {
     20 	SLEEPR_SLEEP,
     21 	SLEEPR_SUSPEND
     22 } sleep_reason_t;
     23 
     24 struct task_struct {
     25 	pid_t pid;
     26 	task_state_t state;
     27 	sleep_reason_t sleep_reason;
     28 	u32 sleep_chan;
     29 	volatile int scheduled;
     30 	struct regs regs;
     31 	struct list_head list;
     32 	void *stack_alloc;
     33 	u32 wakeup_ms;
     34 };
     35 
     36 extern struct task_struct *current;
     37 
     38 void sleep(u32 seconds);
     39 void msleep(u32 milliseconds);
     40 int kthread_create(void (*routine)(void *), void *arg);
     41 void schedule(void);
     42 void sched_disable();
     43 void sched_enable();
     44 int sched_is_enabled();
     45 void suspend_task(u32 channel);
     46 void suspend_task_no_schedule(u32 channel);
     47 void resume_tasks(u32 channel);
     48 
     49 #endif	/* __SCHED_H */