[BACK]Return to kern_sched.h CVS log [TXT][DIR] Up to [local] / funnyos / sys

File: [local] / funnyos / sys / kern_sched.h (download)

Revision 1.1, Mon Nov 19 15:54:33 2007 UTC (16 years, 5 months ago) by nbrk
Branch: MAIN

task scheduler;
nothing is implemented but commit it so i could hack on it at home :)

/*
 * $Id: kern_sched.h,v 1.1 2007/11/19 15:54:33 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
 */
struct taskheader {
	const char *th_name; 				/* task name */
	void 		(*th_enter)(void *arg); /* entry point */
	uint8_t 	ta_priority; 			/* priority, less value = higher priority */
};

/*
 * Kernel sees each system task as struct task;
 * it is used for scheduling and context switches.
 */
struct task {
	struct taskheader 	*ta_theader; 	/* points to user-described data */
	uint8_t 			ta_taskid; 		/* task id (TID) */

	uint8_t 			ta_state; 		/* task state (running, blocked, etc.) */
	uint32_t 			ta_timeo; 		/* timeout (in HZ) if task is blocked */ 
	uint32_t 			*ta_stackptr; 	/* task stack addr (used to switch-back to that task) */
};

/*
 * 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 */


#endif /* not _SYS_KERN_SCHED_H */