/* * $Id: kern_sched.h,v 1.4 2007/11/23 13:37:43 nbrk Exp $ */ #ifndef _SYS_KERN_SCHED_H #define _SYS_KERN_SCHED_H #include #include /* * u_task is used by user to describe task in config.c. * "user task". */ struct u_task { const char *ut_name; /* task name */ uint8_t ut_priority; /* priority, bigger the value = higher priority */ void (*ut_enter)(void); /* entry point */ }; /* * Kernel sees each system task as struct k_task; * it is used for scheduling and context switches. * "kernel task". */ struct k_task { struct u_task *kt_utask; /* points to user-described data */ uint8_t kt_tid; /* task id (TID) */ uint8_t kt_state; /* task state (running, blocked, etc.) */ // uint32_t kt_timeo; /* timeout (in HZ) if task is blocked */ struct pcb kt_pcb; /* hardware context (15 ARM registers) */ struct k_task *kt_next; }; /* * Tasks states. */ #define TASK_NOSCHED 0x00 /* task not ready or halted; will not schedule this */ #define TASK_READY 0x01 /* ready for schedule */ #define TASK_RUNNING 0x02 /* running now */ #define TASK_SLEEPING 0x04 /* task waits for (planned) timeout */ /* * Functions. */ void sched_init(void); void sched_tick(void); #endif /* not _SYS_KERN_SCHED_H */