File: [local] / funnyos / sys / kern_sched.h (download)
Revision 1.3, Tue Nov 20 16:07:23 2007 UTC (16 years, 10 months ago) by nbrk
Branch: MAIN
Changes since 1.2: +32 -15 lines
implement sched_init();
|
/*
* $Id: kern_sched.h,v 1.3 2007/11/20 16:07:23 nbrk Exp $
*/
#ifndef _SYS_KERN_SCHED_H
#define _SYS_KERN_SCHED_H
#include <sys/types.h>
/*
* Task header 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 */
};
#if 0
/*
* Task PCB (process control block).
* this is task's hardware context.
*/
struct pcb __attribute__((packed)) {
/* ARM general purpose registers */
uint32_t p_r0;
}
#endif /* 0 */
/*
* 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 */
uint32_t kt_pcb[15]; /* 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);
#endif /* not _SYS_KERN_SCHED_H */