Annotation of funnyos/sys/kern_sched.h, Revision 1.3
1.1 nbrk 1: /*
1.3 ! nbrk 2: * $Id: kern_sched.h,v 1.2 2007/11/20 12:57:37 nbrk Exp $
1.1 nbrk 3: */
4: #ifndef _SYS_KERN_SCHED_H
5: #define _SYS_KERN_SCHED_H
6: #include <sys/types.h>
7:
8: /*
1.3 ! nbrk 9: * Task header is used by user to describe task in config.c.
! 10: * "user task".
1.1 nbrk 11: */
1.3 ! nbrk 12: struct u_task {
! 13: const char *ut_name; /* task name */
! 14: uint8_t ut_priority; /* priority, bigger the value = higher priority */
! 15: void (*ut_enter)(void); /* entry point */
1.1 nbrk 16: };
17:
1.3 ! nbrk 18:
! 19: #if 0
! 20: /*
! 21: * Task PCB (process control block).
! 22: * this is task's hardware context.
! 23: */
! 24: struct pcb __attribute__((packed)) {
! 25:
! 26: /* ARM general purpose registers */
! 27: uint32_t p_r0;
! 28:
! 29: }
! 30: #endif /* 0 */
! 31:
1.1 nbrk 32: /*
1.3 ! nbrk 33: * Kernel sees each system task as struct k_task;
1.1 nbrk 34: * it is used for scheduling and context switches.
1.3 ! nbrk 35: * "kernel task".
1.1 nbrk 36: */
1.3 ! nbrk 37: struct k_task {
! 38: struct u_task *kt_utask; /* points to user-described data */
! 39: uint8_t kt_tid; /* task id (TID) */
! 40:
! 41: uint8_t kt_state; /* task state (running, blocked, etc.) */
! 42: // uint32_t kt_timeo; /* timeout (in HZ) if task is blocked */
! 43: uint32_t kt_pcb[15]; /* hardware context (15 ARM registers) */
! 44:
1.2 nbrk 45:
1.3 ! nbrk 46: struct k_task *kt_next;
1.1 nbrk 47: };
48:
49: /*
50: * Tasks states.
51: */
52: #define TASK_NOSCHED 0x00 /* task not ready or halted; will not schedule this */
53: #define TASK_READY 0x01 /* ready for schedule */
54: #define TASK_RUNNING 0x02 /* running now */
55: #define TASK_SLEEPING 0x04 /* task waits for (planned) timeout */
1.2 nbrk 56:
57:
58: /*
59: * Functions.
60: */
61: void sched_init(void);
1.1 nbrk 62:
63:
64: #endif /* not _SYS_KERN_SCHED_H */
65:
CVSweb