//----------------------------------------------------------------------------// // GNU GPL OS/K // // // // Authors: spectral` // // NeoX // // // // Desc: Scheduler header // //----------------------------------------------------------------------------// #ifndef _KALKERN_BASE_H #include #endif //------------------------------------------// // Start of header // //------------------------------------------// #ifndef _KALKERN_SCHED_H #define _KALKERN_SCHED_H //------------------------------------------// // Preprocessor // //------------------------------------------// // // Debug stuff // #define printdbg printf // // States for a process // #define STATE_RUNNING 0 #define STATE_RUNNABLE 1 #define STATE_BLOCKED 2 // // Time in ticks a process should be run // #define DEF_PROC_TSLICE 5 // 20 ticks #define TCR_PROC_TSLICE 20000 // 20000 ticks (time critical) //------------------------------------------// // List heads // //------------------------------------------// DECLARE_PER_CPU(IdlePrioProcs, ListHead_t *); DECLARE_PER_CPU(ReglPrioProcs, ListHead_t *); DECLARE_PER_CPU(ServPrioProcs, ListHead_t *); DECLARE_PER_CPU(TimeCritProcs, ListHead_t *); extern const char *PrioClassesNames[]; //------------------------------------------// // Data types // //------------------------------------------// // // A process // typedef struct sProcess_t { // Identifier int pid; // Current priority class int prioClass; // Default priority class (without boosts) int defPrioClass; // Current priority level int prioLevel; // Default priority level int defPrioLevel; // Current state int procState; // Remaining time running ulong timeSlice; // Default time-slice ulong defTimeSlice; // Scheduler internals ListNode_t *schedNode; } Process_t; //------------------------------------------// // Functions // //------------------------------------------// void SchedInit(void); void SchedFini(void); void SchedThisProc(Process_t *); void SchedOnTick(void); //------------------------------------------// // End of header // //------------------------------------------// #endif